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

getParent type is incompatible with newest TS versions #692

Closed
Validark opened this issue Aug 25, 2019 · 3 comments
Closed

getParent type is incompatible with newest TS versions #692

Validark opened this issue Aug 25, 2019 · 3 comments
Labels
Milestone

Comments

@Validark
Copy link
Contributor

In the latest version of TypeScript, this will give you a compile-time error:

function foo(node: ts.Identifier | ts.ExpressionWithTypeArguments) {
	node.getParent();
}

The errors look something like this:
image

This happens due to a change in the way TypeScript handles method unions. If you think this error is incorrect, perhaps a TypeScript issue should be made?

@dsherret dsherret added the bug label Aug 31, 2019
@dsherret
Copy link
Owner

I haven't figured out a way to fix this yet and I'm not sure it's possible in TS 3.6 without changing the method to always being nullable.

This is due to the issue you outlined here: microsoft/TypeScript#32506

@dsherret
Copy link
Owner

I'm so sad, but I'm probably going to do a code generation solution in the final declaration file to solve this :(

dsherret added a commit that referenced this issue Aug 31, 2019
@dsherret
Copy link
Owner

Yeah, this solution is no fun, but I don't see any way around it. This will be fixed in version 4.0 (I hope to get a release out by Tuesday).

@dsherret dsherret added this to the Version 4.0 milestone Sep 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants