Skip to content

Typescript could not resolve typing error #16014

Closed
@artem-malko

Description

@artem-malko

TypeScript Version: 2.3.3

Code

interface Animal {
    name: string;
    size: {
        w?: number;
        h?: number;
    };
}

var dog: Animal = {
    name: 'John',
    size: 'asd',
}

And you can open the link from typescript playground.

Expected behavior:

Typing error, because size is not a string, it is an object with specific shape.

Actual behavior:

No errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions