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

.d.ts generation should define WinRTPromise differently to make mocking easier #106

Open
nichamp opened this issue Jun 23, 2021 · 0 comments
Labels
enhancement New feature or request typescript Bugs/issues/feature asks for typescript generation

Comments

@nichamp
Copy link
Collaborator

nichamp commented Jun 23, 2021

Windows.Foundation.WinRTPromise was defined as (WinRTPromiseBase<TResult, TProgress> & Promise<TResult>) to best represent what is actually projected, but this makes it harder to write mocks. TypeScript requires async methods to return a plain Promise<T> so returning a Windows.Foundation.WinRTPromise wouldn't be possible. Mocks would have to return an explicit Promise object instead of using async methods, or would have to cheat with as. So I would recommend defining Windows.Foundation.WinRTPromise as Promise<TResult> | (WinRTPromiseBase<TResult, TProgress> & Promise<TResult>);

@nichamp nichamp added the enhancement New feature or request label Jun 23, 2021
@dunhor dunhor added the typescript Bugs/issues/feature asks for typescript generation label Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request typescript Bugs/issues/feature asks for typescript generation
Projects
None yet
Development

No branches or pull requests

2 participants