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

Circular inference failure (regression) #16512

Closed
falsandtru opened this issue Jun 14, 2017 · 2 comments
Closed

Circular inference failure (regression) #16512

falsandtru opened this issue Jun 14, 2017 · 2 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@falsandtru
Copy link
Contributor

TypeScript Version: 2.5.0-dev.20170613

Code

I tried to make a simple repro but it failed. I had to add the annotation as follows. The previous code was working until 2.4.0-dev.20170606.

falsandtru/pjax-api@f5dbc6d

-  .extract(parser => (html: string) => Just(parser(html)));
+  .extract(parser => (html: string): Maybe<Document> => Just(parser(html)));

Expected behavior:

no error

Actual behavior:

TypeScript error: src/lib/html.ts(9,22): Error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
@ahejlsberg
Copy link
Member

I'm quite certain this relates to #16072 and #16305. Since we now make inferences from the return types of generic functions we will at times more eagerly resolve return statements and return expressions of lambdas. That appears to be what is happening here and I'm not sure there's much we can do about it.

@ahejlsberg ahejlsberg added the Working as Intended The behavior described is the intended behavior; this is not a bug label Jun 14, 2017
@falsandtru
Copy link
Contributor Author

Hm, okay thanks!

@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

2 participants