mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
Handle multiple return statements that implement interface
This commit is contained in:
parent
66f30c9841
commit
9c562f867d
@ -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() {}
|
||||
//// }|];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user