You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adjust the calls like then to take a Promise<T> and callback from T and return a differently-typed Promise<U>.
Adjust TypeScript codegen to allow specifying the T type (currently it is Promise<any>).
Alternatives
js_sys::Promise -> js_sys::Promise<T = JsValue, E = JsValue> - where E is the typed rejection; this is not how TypeScript types them though, and there are issues in general with errors typing due to the JavaScript language model itself.
Additional Context
I want to replace impl Future<Output = T> with js_sys::Promise<T> in my bindings where applicable.
The text was updated successfully, but these errors were encountered:
Motivation
js_sys::Promise
->js_sys::Promise<T = JsValue>
Better type system has obvious benefits.
Proposed Solution
js_sys::Promise<T = JsValue>
then
to take aPromise<T>
and callback fromT
and return a differently-typedPromise<U>
.T
type (currently it isPromise<any>
).Alternatives
js_sys::Promise
->js_sys::Promise<T = JsValue, E = JsValue>
- whereE
is the typed rejection; this is not how TypeScript types them though, and there are issues in general with errors typing due to the JavaScript language model itself.Additional Context
I want to replace
impl Future<Output = T>
withjs_sys::Promise<T>
in my bindings where applicable.The text was updated successfully, but these errors were encountered: