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
TypeScript has a very expressive type system.
Some of its features have no counterparts in the Rust type system, and in any case wasm-bindgen is unlikely to ever support it in full.
This matters for making high-quality TypeScript APIs for wasm modules, so maybe there should be an escape hatch to manually specify more subtle types than wasm-bindgen could infer.
Motivation
TypeScript has a very expressive type system.
Some of its features have no counterparts in the Rust type system, and in any case
wasm-bindgen
is unlikely to ever support it in full.This matters for making high-quality TypeScript APIs for wasm modules, so maybe there should be an escape hatch to manually specify more subtle types than
wasm-bindgen
could infer.Example:
Proposed Solution
Support the following syntax on exported Rust functions:
When
typescript_signature
is specified,wasm-bindgen
should uncritically use it in the generated .d.ts:The responsibility to ensure that it matches the actual implementation is on the programmer.
Additional Context
This feature could also serve as a workaround for #1591 and #1197 .
The text was updated successfully, but these errors were encountered: