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

Add Property [Symbol.toStringTag] to Dexie.Promise #389

Closed
ChrisPearce opened this issue Dec 5, 2016 · 3 comments
Closed

Add Property [Symbol.toStringTag] to Dexie.Promise #389

ChrisPearce opened this issue Dec 5, 2016 · 3 comments
Labels

Comments

@ChrisPearce
Copy link
Contributor

ChrisPearce commented Dec 5, 2016

When creating observables from Dexie.Promise objects, I'm encountering TypeScript compile errors such as:
[ts] Argument of type 'Dexie.Promise' is not assignable to parameter of type 'Promise'.
Property '[Symbol.toStringTag]' is missing in type 'Promise'.

Does Dexie.Promise support the property Symbol.toStringTag?

@dfahlander
Copy link
Collaborator

Thanks, I put it on todo.

dfahlander added a commit that referenced this issue Dec 8, 2016
Added [Symbol.toStringTag] property to Promise.prototype (in js and d.ts).
Removed Promise.onuncatched from d.ts.
Added Promise.timeout in d.ts.
@dfahlander
Copy link
Collaborator

dfahlander commented Dec 8, 2016

@ChrisPearce, I've added [Symbol.toStringTag], but unfortunately I think you will continue getting compile error with Observable.fromPromise() since it expects exactly Promise or subclass thereof. Try instead with Observable.fromPromise(Promise.resolve(dexiePromise)).

@dfahlander
Copy link
Collaborator

Looking into it a bit more, Promise in lib.es6.d.ts is an interface, not a class. Of some reason, the declaration of Dexie.Promise in dexie.d.ts is not compatible with that interface. Probably just some other adjustments of dexie.d.ts would need to be done to be fully compatible with Promise in lib.es6.d.ts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants