mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 11:24:49 -05:00
Handle multiple return statements that implement interface
This commit is contained in:
@@ -6417,11 +6417,15 @@ namespace ts {
|
||||
return [getReferenceEntryFromNode(parent.initializer)];
|
||||
}
|
||||
else if (isFunctionLike(parent) && parent.type === containingTypeReference && parent.body && parent.body.kind === SyntaxKind.Block) {
|
||||
return [forEachReturnStatement(<Block>parent.body, (returnStatement) => {
|
||||
let result: ReferenceEntry[];
|
||||
|
||||
forEachReturnStatement(<Block>parent.body, (returnStatement) => {
|
||||
if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) {
|
||||
return getReferenceEntryFromNode(returnStatement.expression);
|
||||
(result || (result = [])).push(getReferenceEntryFromNode(returnStatement.expression));
|
||||
}
|
||||
})];
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
else if (isTypeAssertionExpression(parent) && isImplementationExpression(parent.expression)) {
|
||||
return [getReferenceEntryFromNode(parent.expression)];
|
||||
|
||||
@@ -4,7 +4,14 @@
|
||||
|
||||
//// interface Fo/*interface_definition*/o { hello: () => void }
|
||||
////
|
||||
//// let x: number = 9;
|
||||
////
|
||||
//// function createFoo(): Foo {
|
||||
//// if (x === 2) {
|
||||
//// return [|{
|
||||
//// hello() {}
|
||||
//// }|];
|
||||
//// }
|
||||
//// return [|{
|
||||
//// hello() {}
|
||||
//// }|];
|
||||
|
||||
Reference in New Issue
Block a user