-
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.
Browse files
Browse the repository at this point in the history
Component commits: 864c2d4 Check for undefined `source.symbol` Fixes #37014 Co-authored-by: Ryan Cavanaugh <RyanCavanaugh@users.noreply.github.com>
- Loading branch information
1 parent
d76a45a
commit c6866c1
Showing
6 changed files
with
68 additions
and
0 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
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/privateFieldAssignabilityFromUnknown.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,16 @@ | ||
tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts(2,3): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher. | ||
tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts(5,7): error TS2741: Property '#field' is missing in type '{}' but required in type 'Class'. | ||
|
||
|
||
==== tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts (2 errors) ==== | ||
export class Class { | ||
#field: any | ||
~~~~~~ | ||
!!! error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher. | ||
} | ||
|
||
const task: Class = {} as unknown; | ||
~~~~ | ||
!!! error TS2741: Property '#field' is missing in type '{}' but required in type 'Class'. | ||
!!! related TS2728 tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts:2:3: '#field' is declared here. | ||
|
21 changes: 21 additions & 0 deletions
21
tests/baselines/reference/privateFieldAssignabilityFromUnknown.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,21 @@ | ||
//// [privateFieldAssignabilityFromUnknown.ts] | ||
export class Class { | ||
#field: any | ||
} | ||
|
||
const task: Class = {} as unknown; | ||
|
||
|
||
//// [privateFieldAssignabilityFromUnknown.js] | ||
"use strict"; | ||
var _field; | ||
exports.__esModule = true; | ||
var Class = /** @class */ (function () { | ||
function Class() { | ||
_field.set(this, void 0); | ||
} | ||
return Class; | ||
}()); | ||
exports.Class = Class; | ||
_field = new WeakMap(); | ||
var task = {}; |
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/privateFieldAssignabilityFromUnknown.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,12 @@ | ||
=== tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts === | ||
export class Class { | ||
>Class : Symbol(Class, Decl(privateFieldAssignabilityFromUnknown.ts, 0, 0)) | ||
|
||
#field: any | ||
>#field : Symbol(Class.#field, Decl(privateFieldAssignabilityFromUnknown.ts, 0, 20)) | ||
} | ||
|
||
const task: Class = {} as unknown; | ||
>task : Symbol(task, Decl(privateFieldAssignabilityFromUnknown.ts, 4, 5)) | ||
>Class : Symbol(Class, Decl(privateFieldAssignabilityFromUnknown.ts, 0, 0)) | ||
|
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/privateFieldAssignabilityFromUnknown.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,13 @@ | ||
=== tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts === | ||
export class Class { | ||
>Class : Class | ||
|
||
#field: any | ||
>#field : any | ||
} | ||
|
||
const task: Class = {} as unknown; | ||
>task : Class | ||
>{} as unknown : unknown | ||
>{} : {} | ||
|
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,5 @@ | ||
export class Class { | ||
#field: any | ||
} | ||
|
||
const task: Class = {} as unknown; |