- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
From: microsoft/vscode#16819
TypeScript Version: 2.1.4-insiders.20161206
Code
interface CompletionItem {
	a(): number;
}
function func(item: CompletionItem): Promise<CompletionItem> {
	const temp: Promise<any> = null
	return Promise.resolve('abc').then(service => {
		return temp;
	});
}Expected behavior:
No errors.
Actual behavior:
Error:
Type 'Promise<string>' is not assignable to type 'Promise<CompletionItem>'.
  Type 'string' is not assignable to type 'CompletionItem'.
I believe the error comes from then  selecting the incorrect overload during compilation. Changing the type to  Promise.resolve(3) changes the error message to Type Promise<number> is not...
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue