Skip to content

--allowJs: Cannot update prototype of imported class (3.7.0 regression) #34493

Closed
@Knagis

Description

@Knagis

TypeScript Version: 3.7.0-dev.20191015

Code
Initial source:
lodash-es/lodash.default.js file from [email protected]

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)

Playground Link:
http://www.typescriptlang.org/play/?target=1&ts=3.7-Beta&useJavaScript=true#code/JYWwDg9gTgLgBAQTgMyhEcDkDMG4BQCAdGGjBDAJ5gCmRyEEcAvHAAy5A (see error in browser console)

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions