-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
TypeScript Version: 3.1.0-dev.201xxxxx
Search Terms:
Code
type OnlyNumber<T extends number> = T
type ToNumber<T extends number | string> =
T extends string ? undefined : OnlyNumber<T>
Expected behavior:
No errors
Actual behavior:
Error:
index.ts:37:47 - error TS2344: Type 'T' does not satisfy the constraint 'number'.
Type 'string | number' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
37 T extends string ? undefined : OnlyNumber<T>
Related Issues:
falsandtru, kgtkr, vladbarosan, SlurpTheo, flushentitypacket and 5 more
Metadata
Metadata
Assignees
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript