Skip to content

Instantiate contextual types for return expressions #32386

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

Merged
merged 4 commits into from
Jul 24, 2019
Merged

Conversation

ahejlsberg
Copy link
Member

Fixes #32349.

@ahejlsberg
Copy link
Member Author

@typescript-bot run dt
@typescript-bot test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 13, 2019

Heya @ahejlsberg, I've started to run the parallelized Definitely Typed test suite on this PR at 6f637b0. You can monitor the build here. It should now contribute to this PR's status checks.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 13, 2019

Heya @ahejlsberg, I've started to run the extended test suite on this PR at 6f637b0. You can monitor the build here. It should now contribute to this PR's status checks.

@ahejlsberg
Copy link
Member Author

DT test failures look like preexisting conditions unrelated to this PR.

RWC tests have one failure that boils down to this:

declare function foo<T>(x: T | Promise<T>): void;
declare let b: false | Promise<true>;
foo(b);  // Error

We fail to infer boolean for T, instead inferring just true. The issue is the way we give lower priority to direct inferences to naked type parameters in unions. I will think about ways to fix this.

@ahejlsberg
Copy link
Member Author

Verified that there are no differences in RWC tests between this and the master branch.

@ahejlsberg
Copy link
Member Author

So, now that #32460 is in and RWC is clean, I'm going to merge this.

@ahejlsberg ahejlsberg merged commit 34dd4b8 into master Jul 24, 2019
@ahejlsberg ahejlsberg deleted the fix32349 branch July 24, 2019 00:33
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 this pull request may close these issues.

Inconsistent type inference for cases of one and multiple values
2 participants