Skip to content

Type not suggested when implementing an interface's overloaded method #18384

Closed
@bruce965

Description

@bruce965

TypeScript Version: 2.5.2 / nightly (2.6.0-dev.20170910)

Code

interface MyInterface {
	exec(action: 'action_1'): void;
	exec(action: 'action_2'): void;
	exec(action: string): void;
}

const test: MyInterface = {
	exec(arg) {
		// `arg` type is `any`
	}
};

Expected behavior:

I would expect arg type to be "action1"|"action2"|string.

Actual behavior:

arg type is any.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions