-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
TypeScript Version: 4.0.2
Search Terms: unbounded
Code
type Strings = [string, string];
type Numbers = number[];
type Unbounded = [...Strings, ...Numbers, boolean];
// ^?
const data: Unbounded = ['a', 'b', false, false]; // <-- No error?
console.log(data);Expected behavior:
The above Unbounded type should allow only the last element in the tuple as boolean, other elements in range [2, -2] if available should be numbers only.
Actual behavior:
[...number[], boolean] is now handled as <number | boolean>[]
Related Issues:
No.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue