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

Use found thisParameter #30596

Closed
wants to merge 1 commit into from
Closed

Use found thisParameter #30596

wants to merge 1 commit into from

Conversation

XuluWarrior
Copy link

This is a speculative, letter-box fix for #29884

I hope that somebody that understands the code more can advise whether the fix is appropriate.

Fixes #29884

// TODO: GH#18217 We tested that *some* has thisParameter and now act as if *all* do
const thisType = getUnionType(map(unionSignatures, sig => sig.thisParameter ? getTypeOfSymbol(sig.thisParameter) : anyType), UnionReduction.Subtype);
thisParameter = createSymbolWithType(signature.thisParameter!, thisType);
thisParameter = createSymbolWithType(thisParameter, thisType);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We definitely need test for this. The best way to get that would be to run tsc in debug mode without fix and figure out which type in your code base was resulting in the crash and get those signatures to make the union type.
Note that seems like your want union of signatures in which first signature doesn't have this parameter.

@XuluWarrior
Copy link
Author

@sheetalkamat Sorry for not getting back on this sooner.
I was going to try and reproduce this again but when I tried typescript@3.4.3, I no longer got the original compilation error.

I assume there's no benefit to exploring exactly what the problem was in the earlier version.

@sandersn sandersn added this to Curio in Pall Mall Jan 30, 2020
@sandersn sandersn moved this from Curio to Gallery in Pall Mall Jan 30, 2020
@sandersn sandersn added the For Milestone Bug PRs that fix a bug with a specific milestone label Feb 1, 2020
@sandersn
Copy link
Member

@XuluWarrior can you still reproduce this? If so, @sheetalkamat's advice to debug tsc.js in-place is the best idea for finding the source of the problem and producing an independent repro. If not, let me know and I will close this.

@sandersn sandersn added this to Waiting on author in PR Backlog Feb 13, 2020
@sandersn sandersn removed this from Gallery in Pall Mall Feb 14, 2020
@XuluWarrior
Copy link
Author

@sandersn as I mentioned in my earlier comment, as of typescript 3.4.3 we no longer get this issue with our code. Looking at #31560 it is quite probably that that fixed it.

I am happy to consider this closed.

PR Backlog automation moved this from Waiting on author to Done Feb 16, 2020
@XuluWarrior XuluWarrior deleted the cannot-read-property-of-undefined branch February 16, 2020 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Milestone Bug PRs that fix a bug with a specific milestone
Projects
PR Backlog
  
Done
Development

Successfully merging this pull request may close these issues.

Crash with Cannot read property 'flags' of undefined (union related?)
3 participants