-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
Typing: soundnessNo false negatives (type checker claims that there is no error in the incorrect program)No false negatives (type checker claims that there is no error in the incorrect program)Typing: tuplebug
Description
a at the end of following program has tuple type defined as [string, string]
// @flow
const a = ['1', '2'];
const fn = (p: [string, string]) => {
console.log(p);
};
a.unshift(3);
fn(a);I would expect a to be inferred as [number, string, string] or Array<string | number>. Seeing tuple of 2 elements was unexpected.
Aforementioned code results in no error, please try it on Try Flow.
On the contrarry fn2(a) as defined below evaluates without errors:
const fn2 = (p: Array<string | number>) => {
console.log(p);
};eilvelia
Metadata
Metadata
Assignees
Labels
Typing: soundnessNo false negatives (type checker claims that there is no error in the incorrect program)No false negatives (type checker claims that there is no error in the incorrect program)Typing: tuplebug