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

Type PromiseMock<T> is not assignable to type Promise<T> #15

Closed
martindzejky opened this issue Nov 16, 2019 · 2 comments
Closed

Type PromiseMock<T> is not assignable to type Promise<T> #15

martindzejky opened this issue Nov 16, 2019 · 2 comments

Comments

@martindzejky
Copy link

image

Hello, PromiseMock is not assignable to a variable or a parameter that expects the type Promise. The error returned by Typescript is this:

Property '[Symbol.toStringTag]' is missing in type 'PromiseMock<T>' but required in 'Promise<T>'

This makes it hard to use the promise mock in places where a real promise is expected, resulting in us having to cast the value to any. 😞

Versions

  • promise-sync@1.1.7
  • typescript@3.6.4
@slavik57
Copy link
Owner

I'm sorry, but I don't have the time capacity to fix this since it would require a lot of changes since the Promise interface has changed a lot in the newer versions of Typescript.
If you can create a pull request with the minimal needed changes and tests that pass I would review it and merge it.

@martindzejky
Copy link
Author

martindzejky commented Apr 3, 2020

Hello @slavik57 and anyone who ends here in the future. I tried making a PR for your repository but I just could not make it work. So, I ended up making my own repository and library for a promise mock which implements the full Typescript Promise<T> interface. I linked back to your original implementation.

https://github.com/martindzejky/promise-mock

If you need me to add any information to my repo, just let me know. Cheers!

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

No branches or pull requests

2 participants