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 Version:
3.2.1, plus whatever runs on typescriptlang.org playground.
Search Terms:
enum, enum comparable
Code
// A *self-contained* demonstration of the problem follows...// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.
See Playground Link.
Expected behavior:
No error.
Actual behavior:
Error:() TS2678: Type 'Backend.kinvey' is not comparable to type 'Backend.static'.
Related Issues:
Of course in the example some branches of the Switch are unreachable but that should not throw an error. If you delete the statement "backend = Backend.static;" on line 13, while keep the same statement outside the function on line 9, the situation is identical but no error is thrown.
TypeScript Version:
3.2.1, plus whatever runs on typescriptlang.org playground.
Search Terms:
enum, enum comparable
Code
See Playground Link.
Expected behavior:
No error.
Actual behavior:
Error:() TS2678: Type 'Backend.kinvey' is not comparable to type 'Backend.static'.
Playground Link:
https://www.typescriptlang.org/play/index.html#src=enum%20Backend%20%7B%0D%0A%20%20%20%20%20%20%20%20url%2C%0D%0A%20%20%20%20%20%20%20%20kinvey%2C%0D%0A%20%20%20%20%20%20%20%20static%0D%0A%7D%0D%0A%20%20%20%20%0D%0Avar%20backend%3A%20Backend%3B%0D%0A%0D%0Abackend%20%3D%20Backend.static%3B%0D%0Acompare()%3B%0D%0A%0D%0Afunction%20compare()%20%7B%0D%0A%20%20%20%20backend%20%3D%20Backend.static%3B%0D%0A%0D%0A%20%20%20%20switch%20(backend)%20%7B%0D%0A%20%20%20%20%20%20%20%20case%20Backend.static%3A%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20break%3B%0D%0A%0D%0A%20%20%20%20%20%20%20%20case%20Backend.kinvey%3A%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20break%3B%0D%0A%0D%0A%20%20%20%20%20%20%20%20case%20Backend.url%3A%0D%0A%20%20%20%20%20%20%20%20default%3A%0D%0A%20%20%20%20%20%20%20%20%2F%2F%0D%0A%20%20%20%20%7D%0D%0A%7D
Related Issues:
Of course in the example some branches of the Switch are unreachable but that should not throw an error. If you delete the statement "backend = Backend.static;" on line 13, while keep the same statement outside the function on line 9, the situation is identical but no error is thrown.