TypeScript/tests/cases/conformance/salsa/propertyAssignmentUseParentType3.ts
Eli Barzilay d6c05a1358 Fix getEffectiveTypeAnnotationNode
Prevent it from using the (return) type of a function.  Could also check
the condition before calling the function, but there are two places that
need the check, and OTOH, all calls check the result so returning
`undefined` should work.

(This problem was introduced in PR#32553.)

Fixes #33741.
2020-01-03 22:47:17 -05:00

22 lines
325 B
TypeScript

// don't use the parent type if it's a function declaration (#33741)
function foo1(): number {
return 123;
}
foo1.toFixed = "";
function foo2(): any[] {
return [];
}
foo2.join = "";
function foo3(): string {
return "";
}
foo3.trim = "";
function foo4(): ({x: number}) {
return {x: 123};
}
foo4.x = "456";