-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Labels
enhancementNew feature or requestNew feature or requestinferenceRelated to inferring the restriction of poly typesRelated to inferring the restriction of poly typesneeds-investigationFurther information is requestedFurther information is requested
Description
There could be a new intrinsic type that allows the argument but raises an error when it is matched.
This would enable the technically correct, but unideal behaviour of functions like Math.sin
type NumberLike = number | Warn<any, "implicit cast">;
// ^^^^
interface Math {
sin(x: NumberLike): number;
}
declare const Math: Math;
// Warning (not error): "2.2" is allowed but is a "implicit cast"
Math.sin("2.2") This is aimed at avoiding false positives in constraint inference #197 #35
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestinferenceRelated to inferring the restriction of poly typesRelated to inferring the restriction of poly typesneeds-investigationFurther information is requestedFurther information is requested