-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
π Search Terms
wrong enum behaviour numeric enum wrong check inconsistent enum behaviour
π Version & Regression Information
I see it in all versions of ts
β― Playground Link
π» Code
enum myEnum {
a = 'a',
b = 'b',
}
enum extendedEnum {
a = "a",
b = "b",
//use any number here, 11 is random value
c = 11,
}
//use any number here, 48 is random value
const returnsMyEnum = function() : myEnum {
return 48;
}
const returnMyExtendedEnum = function() : extendedEnum {
return 48;
}
π Actual behavior
Only returnsMyEnum gives typescript error.
π Expected behavior
Both functions are wrong.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created