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
Type 'E' is not assignable to type 'number' as required for computed enum member values.
π Expected behavior
No error should appear. Nothing in that code snippets expects numbers so this message is really confusing, especially that I'm just trying to use one string-valued enum in another one.
Yeah, I discovered that as well. In real code, both E1 & enums are bigger and a part of a separate package so I'd need to change its API to export the enums directly.
Emit can't rely on type information, and the emitter needs to know whether E2.A should be a string or numeric value (since string and numeric values have different enum emit), and the only way to do that is with type information.
π Search Terms
Type is not assignable to type 'number' as required for computed enum member values
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?ts=5.2.2#code/KYOwrgtgBAogjFA3gKClAglAvFA5O3AGmQF9lkBjAexAGcAXKUSW7JVWOYkgbnOegwATOzSYcA2gDp4U9N2RA
π» Code
π Actual behavior
An error appears:
π Expected behavior
No error should appear. Nothing in that code snippets expects numbers so this message is really confusing, especially that I'm just trying to use one string-valued enum in another one.
Additional information about the issue
Possibly related: #40793
In that issue, people are reporting similar problems, e.g.: #40793 (comment)
The text was updated successfully, but these errors were encountered: