d6c05a1358
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.
21 lines
325 B
TypeScript
21 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";
|