Closed
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.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
jcalz commentedon Aug 29, 2022
Duplicate of #26362
fatcerberus commentedon Aug 30, 2022
Iβm suddenly reminded of this
https://xkcd.com/221/
typescript-bot commentedon Sep 1, 2022
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.