-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
TypeScript Version: 2.2.1 / nightly (2.2.0-dev.201xxxxx)
export interface Vector {
x:number;
y:number;
}
type Point = [number, number];
const Vectors: Vector[] = [];
// Error in the affectation
const points:Array<Point> = Vectors.map((Vector) => {
return [Vector.x, Vector.y];
});
// This is working
const pointsOk:Array<Point> = Vectors.map((Vector) => {
return <Point>[Vector.x, Vector.y];
});Expected behavior:
The compiler should understand I am returning a tuple and not an array of values
Actual behavior:
I get an error and need to cast the conversion to get the right behaviour
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug