-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid getting undefined
callSignatures
/constructSignatures
in `ge…
…tPropertyOfType` e350c35 (#40228) introduced a subtle bug: it switched the flags to an alias, dropping `SymbolFlags.Property` --- and that makes `symbolIsValue()` get to the `resolveAlias(symbol)` call, which leads to `getPropertyOfType()` with`resolved.callSignatures`+`constructSignatures` being `undefined`. So initialize them in `setStructuredTypeMembers` before calling `getNamedMembers()`. Fixes #42350
- Loading branch information
1 parent
b792214
commit 5a903d3
Showing
9 changed files
with
106 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
tests/cases/conformance/salsa/x.js(1,9): error TS2339: Property 'fn1' does not exist on type 'typeof import("tests/cases/conformance/salsa/x")'. | ||
|
||
|
||
==== tests/cases/conformance/salsa/x.js (1 errors) ==== | ||
exports.fn1(); | ||
~~~ | ||
!!! error TS2339: Property 'fn1' does not exist on type 'typeof import("tests/cases/conformance/salsa/x")'. | ||
exports.fn2 = Math.min; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
=== tests/cases/conformance/salsa/x.js === | ||
exports.fn1(); | ||
>exports : Symbol("tests/cases/conformance/salsa/x", Decl(x.js, 0, 0)) | ||
|
||
exports.fn2 = Math.min; | ||
>exports.fn2 : Symbol(fn2, Decl(x.js, 0, 14)) | ||
>exports : Symbol(fn2, Decl(x.js, 0, 14)) | ||
>fn2 : Symbol(fn2, Decl(x.js, 0, 14)) | ||
>Math.min : Symbol(fn2, Decl(lib.es5.d.ts, --, --)) | ||
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) | ||
>min : Symbol(fn2, Decl(lib.es5.d.ts, --, --)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
=== tests/cases/conformance/salsa/x.js === | ||
exports.fn1(); | ||
>exports.fn1() : any | ||
>exports.fn1 : any | ||
>exports : typeof import("tests/cases/conformance/salsa/x") | ||
>fn1 : any | ||
|
||
exports.fn2 = Math.min; | ||
>exports.fn2 = Math.min : (...values: number[]) => number | ||
>exports.fn2 : (...values: number[]) => number | ||
>exports : typeof import("tests/cases/conformance/salsa/x") | ||
>fn2 : (...values: number[]) => number | ||
>Math.min : (...values: number[]) => number | ||
>Math : Math | ||
>min : (...values: number[]) => number | ||
|
10 changes: 10 additions & 0 deletions
10
tests/baselines/reference/moduleExportsAliasLoop2.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
tests/cases/conformance/salsa/x.js(2,9): error TS2339: Property 'fn1' does not exist on type 'typeof import("tests/cases/conformance/salsa/x")'. | ||
|
||
|
||
==== tests/cases/conformance/salsa/x.js (1 errors) ==== | ||
const Foo = { min: 3 }; | ||
exports.fn1(); | ||
~~~ | ||
!!! error TS2339: Property 'fn1' does not exist on type 'typeof import("tests/cases/conformance/salsa/x")'. | ||
exports.fn2 = Foo.min; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
=== tests/cases/conformance/salsa/x.js === | ||
const Foo = { min: 3 }; | ||
>Foo : Symbol(Foo, Decl(x.js, 0, 5)) | ||
>min : Symbol(min, Decl(x.js, 0, 13)) | ||
|
||
exports.fn1(); | ||
>exports : Symbol("tests/cases/conformance/salsa/x", Decl(x.js, 0, 0)) | ||
|
||
exports.fn2 = Foo.min; | ||
>exports.fn2 : Symbol(fn2, Decl(x.js, 1, 14)) | ||
>exports : Symbol(fn2, Decl(x.js, 1, 14)) | ||
>fn2 : Symbol(fn2, Decl(x.js, 1, 14)) | ||
>Foo : Symbol(Foo, Decl(x.js, 0, 5)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
=== tests/cases/conformance/salsa/x.js === | ||
const Foo = { min: 3 }; | ||
>Foo : {} | ||
>{ min: 3 } : {} | ||
>min : number | ||
>3 : 3 | ||
|
||
exports.fn1(); | ||
>exports.fn1() : any | ||
>exports.fn1 : any | ||
>exports : typeof import("tests/cases/conformance/salsa/x") | ||
>fn1 : any | ||
|
||
exports.fn2 = Foo.min; | ||
>exports.fn2 = Foo.min : any | ||
>exports.fn2 : any | ||
>exports : typeof import("tests/cases/conformance/salsa/x") | ||
>fn2 : any | ||
>Foo.min : any | ||
>Foo : {} | ||
>min : any | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// @noEmit: true | ||
// @allowJs: true | ||
// @checkJs: true | ||
// @filename: x.js | ||
exports.fn1(); | ||
exports.fn2 = Math.min; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// @noEmit: true | ||
// @allowJs: true | ||
// @checkJs: true | ||
// @filename: x.js | ||
const Foo = { min: 3 }; | ||
exports.fn1(); | ||
exports.fn2 = Foo.min; |