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

Lack of generator return type inference #105

Open
deklanw opened this issue May 21, 2019 · 5 comments
Open

Lack of generator return type inference #105

deklanw opened this issue May 21, 2019 · 5 comments

Comments

@deklanw
Copy link
Contributor

deklanw commented May 21, 2019

Just noticed this while looking through the examples. Turns out it's a Typescript limitation which is going to be fixed soon (hopefully):

microsoft/TypeScript#2983
microsoft/TypeScript#30555

Just making an issue for it in anticipation.

@Jomik
Copy link
Member

Jomik commented May 23, 2019

We do sort of fix this issue with our own typescript compiler plugin.
https://github.com/funkia/go-notation

@paldepind
Copy link
Member

Unfortunately, I don't think any of the new features in TypeScript addresses this issue. As far as i can tell, even with the planned improvements the yield keyword will still always results in any 😭

@deklanw
Copy link
Contributor Author

deklanw commented May 30, 2019

@Jomik
Thanks I'll try that out

@paldepind
I didn't look hard into the TS issue. Why will these changes not help?

@Jomik
Copy link
Member

Jomik commented May 30, 2019

All the yield statements will still return any with the typescript update, so we can still not infer or typecheck the return value, so it does not help that much.

@deklanw
Copy link
Contributor Author

deklanw commented Jun 8, 2019

I read more properly about generators/iterators and I understand better now. In case it helps someone else: it's because in general there is no connection between the Next type and Yield type.

Although, microsoft/TypeScript#30790 (comment)

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

No branches or pull requests

3 participants