[Typescript] Improving flow typings #1378 #1409
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an attempt to fix #1378
This is a breaking change to flow typings that requires TS version 3.6+
I am still not sold on the final solution, but I see two major alternatives:
Generator<Promise<any>, R, unknown>
, so that we get inferred return type, type-check on yielded promises and that we're required to type yield results, which is somewhat similar to what we had beforeBoth of this are not perfect and still breaking, because TS changed
Generator
interface.It seems that there's a possibility to escape the breaking change by utilising
typesVersions
as mentioned here, however I am not quite sure I understand how to do thatIt is also worth mentioning that with arriving of
actionAsync
this problem might not be that important, and we might just use the second alternative to fix TS errors and not rely on lots of TS magic