Open deklanw opened 5 years ago
We do sort of fix this issue with our own typescript compiler plugin. https://github.com/funkia/go-notation
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
:sob:
@Jomik Thanks I'll try that out
@paldepind I didn't look hard into the TS issue. Why will these changes not help?
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.
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, https://github.com/microsoft/TypeScript/pull/30790#issuecomment-480550228
Just noticed this while looking through the examples. Turns out it's a Typescript limitation which is going to be fixed soon (hopefully):
https://github.com/microsoft/TypeScript/issues/2983 https://github.com/Microsoft/TypeScript/issues/30555
Just making an issue for it in anticipation.