-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
Typing IRejectedPromise and IPendingPromise to hold an unknown value #291
Comments
👋 @mweststrate not sure if you are still the main maintainer but you are the last person who edited the lines I'm proposing to change. WDYT? |
TypeScript itself defines the error "reason" as At this point I could go either way. |
@NaridaL regarding the error, you are right that it is for historical reason. They actually recently allowed to specified Now regarding my proposal, that is actually more about the value than the error, the problem is |
Good point about forgetting to check the state. If you create a PR I'll merge it. |
@NaridaL cool I"ll get that ready on Monday then. Just a heads up that it will make the type definition incompatible with any version of TS below 3.0 and will probably "break" code that was compiling before. The first caveat is probably OK by now since 3.0 was released more than 2 years ago, but if we still want to make sure we don't break existing setup we can make use of the typesVersions field. For the the second one, while annoying, I believe is for the best since it would reveal unchecked code paths. |
When using
fromPromise
the pending and rejected outcome have avalue
property typed toany
. Now that we haveunknown
type I thinks in this case it makes more sense and allows us to catch issues a compile-time.Risks wise, it would introduce an incompatibility with the older versions of TS (<3.0) and would probably make some code that was passing type checking before, fail now.
FYI this is what I used right now as a local override:
If you're happy with the proposal, I can submit a PR.
The text was updated successfully, but these errors were encountered: