-
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.
Use emptyObjectType for omitted members instead of unknownType (#20940)
* Use emptyObjectType for omitted members instead of unknownType * Use similar logic as is used for empty arrays for missing elements
- Loading branch information
Showing
18 changed files
with
98 additions
and
44 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
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
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
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
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
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
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
9 changes: 9 additions & 0 deletions
9
tests/baselines/reference/initializedDestructuringAssignmentTypes.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,9 @@ | ||
tests/cases/compiler/initializedDestructuringAssignmentTypes.ts(3,3): error TS2339: Property 'toFixed' does not exist on type 'string'. | ||
|
||
|
||
==== tests/cases/compiler/initializedDestructuringAssignmentTypes.ts (1 errors) ==== | ||
const [, a = ''] = ''.match('') || []; | ||
|
||
a.toFixed() | ||
~~~~~~~ | ||
!!! error TS2339: Property 'toFixed' does not exist on type 'string'. |
8 changes: 8 additions & 0 deletions
8
tests/baselines/reference/initializedDestructuringAssignmentTypes.js
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,8 @@ | ||
//// [initializedDestructuringAssignmentTypes.ts] | ||
const [, a = ''] = ''.match('') || []; | ||
|
||
a.toFixed() | ||
|
||
//// [initializedDestructuringAssignmentTypes.js] | ||
var _a = ''.match('') || [], _b = _a[1], a = _b === void 0 ? '' : _b; | ||
a.toFixed(); |
9 changes: 9 additions & 0 deletions
9
tests/baselines/reference/initializedDestructuringAssignmentTypes.symbols
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/compiler/initializedDestructuringAssignmentTypes.ts === | ||
const [, a = ''] = ''.match('') || []; | ||
>a : Symbol(a, Decl(initializedDestructuringAssignmentTypes.ts, 0, 8)) | ||
>''.match : Symbol(String.match, Decl(lib.d.ts, --, --)) | ||
>match : Symbol(String.match, Decl(lib.d.ts, --, --)) | ||
|
||
a.toFixed() | ||
>a : Symbol(a, Decl(initializedDestructuringAssignmentTypes.ts, 0, 8)) | ||
|
19 changes: 19 additions & 0 deletions
19
tests/baselines/reference/initializedDestructuringAssignmentTypes.types
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,19 @@ | ||
=== tests/cases/compiler/initializedDestructuringAssignmentTypes.ts === | ||
const [, a = ''] = ''.match('') || []; | ||
> : undefined | ||
>a : string | ||
>'' : "" | ||
>''.match('') || [] : RegExpMatchArray | [undefined, ""] | ||
>''.match('') : RegExpMatchArray | ||
>''.match : (regexp: string | RegExp) => RegExpMatchArray | ||
>'' : "" | ||
>match : (regexp: string | RegExp) => RegExpMatchArray | ||
>'' : "" | ||
>[] : [undefined, ""] | ||
|
||
a.toFixed() | ||
>a.toFixed() : any | ||
>a.toFixed : any | ||
>a : string | ||
>toFixed : any | ||
|
3 changes: 3 additions & 0 deletions
3
tests/cases/compiler/initializedDestructuringAssignmentTypes.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,3 @@ | ||
const [, a = ''] = ''.match('') || []; | ||
|
||
a.toFixed() |