Skip to content

Weak Type Detection - not being detected with const #18250

Closed
@alan-agius4

Description

@alan-agius4

TypeScript Version: 2.5.2

Code

function foo(_opts: Options) {
    // do something;
    return;
}

interface Options {
    data?: any;
    show?: boolean;
}

interface OptionsExtended extends Options {
    title?: string;
}

const opts = {
    show: true,
    title: "title"
};

// this works
foo(opts);

// this doesn't
foo({
    show: true,
    title: "title"
});

Expected behavior:
Both of them to emit an error

Actual behavior:
the first one works and doesn't emit an error

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions