-
Notifications
You must be signed in to change notification settings - Fork 99
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
PromiseProxyMixin uses RSVP.Promise which is incompatible with native Promises #341
Comments
In the typings we've written, we've made a point to capture what the types actually are, and so long as Ember is using RSVP, we want the types to model that accurately (so we won't be changing them any time soon!). It's often possible to use |
It might be nice to have a section of the docs describing how one might override this kind of thing in their own project
For world-class web developer training: https://mike.works
…________________________________
From: Chris Krycho <[email protected]>
Sent: Monday, October 15, 2018 4:10:27 PM
To: typed-ember/ember-cli-typescript
Cc: Subscribed
Subject: Re: [typed-ember/ember-cli-typescript] PromiseProxyMixin uses RSVP.Promise which is incompatible with native Promises (#341)
In the typings we've written, we've made a point to capture what the types actually are, and so long as Ember is using RSVP, we want the types to model that accurately (so we won't be changing them any time soon!).
It's often possible to use PromiseLike<T> instead of Promise<T> in your types, thought that doesn't solve behavior around async or await. It's also fine to do a type-cast: as Promise. RSVP.Promise is (by definition of its conformance to the A+ Promises spec) a strict superset of the native Promise type, and so will work for type purposes as a native Promise. In short, you should be able use an RSVP.Promise anywhere native Promise is desired, but not necessarily vice versa.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#341 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AAiDtU77W7PsC6t3f4Pc37QmrbqY5w79ks5ulRXjgaJpZM4XbyAd>.
|
This has largely been resolved by way of a few changes:
Closing this accordingly! |
We discussed this in these two comments - here and here.
The problem is that
PromiseProxyMixin
usesRSVP.Promise
in its type definition which makes it impossible to work with in TypeScript using native promises. And because Ember.js will be moving away from using RSVP at some point, this has to be figured out.The text was updated successfully, but these errors were encountered: