Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--allowJs (3.7.0 regression): Cannot reference this when extending imported function prototype #34647

Closed
Knagis opened this issue Oct 22, 2019 · 2 comments · Fixed by #34650
Closed

Comments

@Knagis
Copy link
Contributor

Knagis commented Oct 22, 2019

TypeScript Version: 3.7.x-dev.20191021

Search Terms:

  • Cannot set property 'symbol' of undefined

Code
Originally encountered when transpiling BabylonJS ES6 code (@babylonjs/core/Animations/animatable.js)

Minimum repro:

import { A } from "./a";

A.prototype.foo = function () {
    this.bar = 0;
};

Expected behavior:
Code is transpiled.

Actual behavior:

node_modules\typescript\lib\tsc.js:23641
            node.symbol = symbol;
                        ^

TypeError: Cannot set property 'symbol' of undefined
    at addDeclarationToSymbol (node_modules\typescript\lib\tsc.js:23641:25)
    at bindThisPropertyAssignment (node_modules\typescript\lib\tsc.js:25564:25)
    at bindWorker (node_modules\typescript\lib\tsc.js:25270:29)
    at bind (node_modules\typescript\lib\tsc.js:25165:13)
    at bindExpressionStatement (node_modules\typescript\lib\tsc.js:24496:13)
    at bindChildrenWorker (node_modules\typescript\lib\tsc.js:24002:21)
    at bindChildren (node_modules\typescript\lib\tsc.js:23923:17)
    at bind (node_modules\typescript\lib\tsc.js:25171:21)
    at node_modules\typescript\lib\tsc.js:23929:68
    at bindEach (node_modules\typescript\lib\tsc.js:23945:21)
error Command failed with exit code 1.

Playground Link:

http://www.typescriptlang.org/play/?ts=3.7-Beta&ssl=3&ssc=2&pln=1&pc=1#code/JYWwDg9gTgLgBAbzgQTgXzgMyhEcBEAdAPQCG+A3AFBXKFg4wQwCeYApoZhBHALxYArgDsAxjGARhcABQBKRFTjK4MABbAAzoQBGpKPzgAGamgpA (see errors in browser console)

Related Issues:

#34493

@Knagis
Copy link
Contributor Author

Knagis commented Oct 22, 2019

@sandersn - you seem to be the person looking into the similar issues.

@Knagis
Copy link
Contributor Author

Knagis commented Oct 22, 2019

Created a PR #34650 with a fix that follows the same approach as #34566.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant