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
error: TS2367 [ERROR]: This comparison appears to be unintentional because the types 'Readonly<{ B: 0; "0": "B"; C: 1; "1": "C"; }>' and 'number' have no overlap.
console.log(b() === 0);
~~~~~~~~~
wasm-bindgen 0.2.91
The text was updated successfully, but these errors were encountered:
It seems like TypeScript is interpreting the @returns {A} as @returns {typeof A} for some reason.
Is this happening in Deno? I can reproduce it with Deno, but not with plain TSC, I think because TSC automatically checks for b.d.ts and Deno doesn't. If it is, you can get Deno to use the proper type annotations instead of the JSDoc ones with @deno-types:
Add @enum {number} to export const A. This isn't as good as it being a real TypeScript enum, it basically just declares type A = number but it fixes the error.
Add a /// <reference types="..." /> to the JS file when using --target deno so that Deno can pick up the proper type declarations in the first place.
Probably we should do both, since the JSDoc declarations should work if necessary (e.g. --no-typescript is passed) but then the TypeScript declarations should be used if available.
No, Deno's behaviour is correct. One of their goals is not to magically look up extra files since that might be wasting extra network requests, and so they differ from tsc here. tsc gives the same error if you delete the .d.ts file.
Describe the Bug
rust enums in return position are typed as object, but at runtime they're just a number
Steps to Reproduce
wasm-bindgen 0.2.91
The text was updated successfully, but these errors were encountered: