You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
--allowJs: Cannot update prototype of imported class (3.7.0 regression) #34493
Code
Initial source: lodash-es/lodash.default.js file from lodash-es@4.17.15
Minimum repro:
import A from 'A';
A.prototype.foo = 0;
Expected behavior:
Code transpiles without errors
Actual behavior:
node_modules\typescript\lib\tsc.js:23676
node.symbol = symbol;
TypeError: node_modules\lodash-es\lodash.default.js: Cannot set property 'symbol' of undefined
at addDeclarationToSymbol (node_modules/typescript/lib/typescript.js:29235:25)
at bindPotentiallyMissingNamespaces (node_modules/typescript/lib/typescript.js:31604:17)
at bindPropertyAssignment (node_modules/typescript/lib/typescript.js:31656:31)
at bindPrototypePropertyAssignment (node_modules/typescript/lib/typescript.js:31544:13)
at bindWorker (node_modules/typescript/lib/typescript.js:31139:29)
at bind (node_modules/typescript/lib/typescript.js:31027:13)
at bindExpressionStatement (node_modules/typescript/lib/typescript.js:30235:13)
at bindChildrenWorker (node_modules/typescript/lib/typescript.js:29693:21)
at bindChildren (node_modules/typescript/lib/typescript.js:29614:17)
at bind (node_modules/typescript/lib/typescript.js:31038:21)
changed the title [-]Cannot set property 'symbol' of undefined: 3.7.0 cannot transpile lodash-es/lodash.defaults.js[/-][+]--allowJs: Cannot update prototype of imported class (3.7.0)[/+]on Oct 15, 2019
changed the title [-]--allowJs: Cannot update prototype of imported class (3.7.0)[/-][+]--allowJs: Cannot update prototype of imported class (3.7.0 regression)[/+]on Oct 16, 2019
A is an alias symbol, which doesn't get a valueDeclaration, but the expando binding assumes that the original symbol has a valueDeclaration.
I'm not sure whether the right fix is to not skip expando binding when the original symbol doesn't have a valueDeclaration, or to rebind the alias' declaration as a valueDeclaration. I'll try both and see which behaves better.
Since the RC snaps at 2 PM today, I'm going to fix the crash (option 1 above) and investigate the follow-on crash from option 2 afterward. Option 2 should restore the pre-3.7 behaviour when it works.
Activity
Knagis commentedon Oct 15, 2019
Minimum repro:
[-]Cannot set property 'symbol' of undefined: 3.7.0 cannot transpile lodash-es/lodash.defaults.js[/-][+]--allowJs: Cannot update prototype of imported class (3.7.0)[/+][-]--allowJs: Cannot update prototype of imported class (3.7.0)[/-][+]--allowJs: Cannot update prototype of imported class (3.7.0 regression)[/+]sandersn commentedon Oct 18, 2019
Ais an alias symbol, which doesn't get a valueDeclaration, but the expando binding assumes that the original symbol has a valueDeclaration.I'm not sure whether the right fix is to not skip expando binding when the original symbol doesn't have a valueDeclaration, or to rebind the alias' declaration as a valueDeclaration. I'll try both and see which behaves better.
sandersn commentedon Oct 18, 2019
Since the RC snaps at 2 PM today, I'm going to fix the crash (option 1 above) and investigate the follow-on crash from option 2 afterward. Option 2 should restore the pre-3.7 behaviour when it works.
sandersn commentedon Oct 18, 2019
My historical repro was set up wrong -- now that I've fixed it, I can see that this never worked, so I will probably leave it at fixing the crash.
Fix crash in expando assignment to alias
Fix crash in expando assignment to alias (#34566)