Skip to content

[T] tuple type information is lost as T[] #8276

Closed

Description

TypeScript Version:

nightly (1.9.0-dev.20160213)

Code

interface Geo {
    latlng: [number, number]  // tuple
}

function world(geo: Geo) {}

world({ latlng: [35, -112] });  // works fine

let coordinates = { latlng: [35, -112] };
world(coordinates);  // errors

let coordinatesTyped: Geo = { latlng: [35, -112] };
world(coordinatesTyped);  // works fine

Expected behavior:

Compile without errors.

Actual behavior:

Error, [T] tuple type information is lost as T[]:

Type 'number[]' is not assignable to type '[number, number]'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    By DesignDeprecated - use "Working as Intended" or "Design Limitation" instead

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions