mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
isExpandoFunctionDeclaration only checks values (#27052)
Previously it checked types too, which caused a crash because types don't have valueDeclaration set. But expando functions can't export types, only values.
This commit is contained in:
parent
6bd1da20c9
commit
2f8a646f8e
@ -28154,7 +28154,7 @@ namespace ts {
|
||||
if (!symbol || !(symbol.flags & SymbolFlags.Function)) {
|
||||
return false;
|
||||
}
|
||||
return !!forEachEntry(getExportsOfSymbol(symbol), p => isPropertyAccessExpression(p.valueDeclaration));
|
||||
return !!forEachEntry(getExportsOfSymbol(symbol), p => p.flags & SymbolFlags.Value && isPropertyAccessExpression(p.valueDeclaration));
|
||||
}
|
||||
|
||||
function getPropertiesOfContainerFunction(node: Declaration): Symbol[] {
|
||||
|
||||
23
tests/baselines/reference/declarationEmitOfFuncspace.js
Normal file
23
tests/baselines/reference/declarationEmitOfFuncspace.js
Normal file
@ -0,0 +1,23 @@
|
||||
//// [expando.ts]
|
||||
// #27032
|
||||
function ExpandoMerge(n: number) {
|
||||
return n;
|
||||
}
|
||||
namespace ExpandoMerge {
|
||||
export interface I { }
|
||||
}
|
||||
|
||||
|
||||
//// [expando.js]
|
||||
// #27032
|
||||
function ExpandoMerge(n) {
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
//// [expando.d.ts]
|
||||
declare function ExpandoMerge(n: number): number;
|
||||
declare namespace ExpandoMerge {
|
||||
interface I {
|
||||
}
|
||||
}
|
||||
16
tests/baselines/reference/declarationEmitOfFuncspace.symbols
Normal file
16
tests/baselines/reference/declarationEmitOfFuncspace.symbols
Normal file
@ -0,0 +1,16 @@
|
||||
=== tests/cases/compiler/expando.ts ===
|
||||
// #27032
|
||||
function ExpandoMerge(n: number) {
|
||||
>ExpandoMerge : Symbol(ExpandoMerge, Decl(expando.ts, 0, 0), Decl(expando.ts, 3, 1))
|
||||
>n : Symbol(n, Decl(expando.ts, 1, 22))
|
||||
|
||||
return n;
|
||||
>n : Symbol(n, Decl(expando.ts, 1, 22))
|
||||
}
|
||||
namespace ExpandoMerge {
|
||||
>ExpandoMerge : Symbol(ExpandoMerge, Decl(expando.ts, 0, 0), Decl(expando.ts, 3, 1))
|
||||
|
||||
export interface I { }
|
||||
>I : Symbol(I, Decl(expando.ts, 4, 24))
|
||||
}
|
||||
|
||||
13
tests/baselines/reference/declarationEmitOfFuncspace.types
Normal file
13
tests/baselines/reference/declarationEmitOfFuncspace.types
Normal file
@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/expando.ts ===
|
||||
// #27032
|
||||
function ExpandoMerge(n: number) {
|
||||
>ExpandoMerge : (n: number) => number
|
||||
>n : number
|
||||
|
||||
return n;
|
||||
>n : number
|
||||
}
|
||||
namespace ExpandoMerge {
|
||||
export interface I { }
|
||||
}
|
||||
|
||||
9
tests/cases/compiler/declarationEmitOfFuncspace.ts
Normal file
9
tests/cases/compiler/declarationEmitOfFuncspace.ts
Normal file
@ -0,0 +1,9 @@
|
||||
// @declaration: true
|
||||
// @Filename: expando.ts
|
||||
// #27032
|
||||
function ExpandoMerge(n: number) {
|
||||
return n;
|
||||
}
|
||||
namespace ExpandoMerge {
|
||||
export interface I { }
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user