-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into FixOrganizeImports
- Loading branch information
Showing
20 changed files
with
503 additions
and
59 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
4 changes: 2 additions & 2 deletions
4
tests/baselines/reference/objectSpreadRepeatedComplexity.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
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
47 changes: 47 additions & 0 deletions
47
tests/baselines/reference/optionalPropertyAssignableToStringIndexSignature.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,47 @@ | ||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/optionalPropertyAssignableToStringIndexSignature.ts(6,1): error TS2322: Type '{ k1: string | undefined; }' is not assignable to type '{ [key: string]: string; }'. | ||
Property 'k1' is incompatible with index signature. | ||
Type 'string | undefined' is not assignable to type 'string'. | ||
Type 'undefined' is not assignable to type 'string'. | ||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/optionalPropertyAssignableToStringIndexSignature.ts(10,1): error TS2322: Type '{ 1?: string | undefined; }' is not assignable to type '{ [key: number]: string; }'. | ||
Property '1' is incompatible with index signature. | ||
Type 'string | undefined' is not assignable to type 'string'. | ||
Type 'undefined' is not assignable to type 'string'. | ||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/optionalPropertyAssignableToStringIndexSignature.ts(13,5): error TS2322: Type '{ k1?: undefined; }' is not assignable to type '{ [key: string]: string; }'. | ||
Property 'k1' is incompatible with index signature. | ||
Type 'undefined' is not assignable to type 'string'. | ||
|
||
|
||
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/optionalPropertyAssignableToStringIndexSignature.ts (3 errors) ==== | ||
declare let optionalProperties: { k1?: string }; | ||
declare let undefinedProperties: { k1: string | undefined }; | ||
|
||
declare let stringDictionary: { [key: string]: string }; | ||
stringDictionary = optionalProperties; // ok | ||
stringDictionary = undefinedProperties; // error | ||
~~~~~~~~~~~~~~~~ | ||
!!! error TS2322: Type '{ k1: string | undefined; }' is not assignable to type '{ [key: string]: string; }'. | ||
!!! error TS2322: Property 'k1' is incompatible with index signature. | ||
!!! error TS2322: Type 'string | undefined' is not assignable to type 'string'. | ||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'. | ||
|
||
declare let probablyArray: { [key: number]: string }; | ||
declare let numberLiteralKeys: { 1?: string }; | ||
probablyArray = numberLiteralKeys; // error | ||
~~~~~~~~~~~~~ | ||
!!! error TS2322: Type '{ 1?: string | undefined; }' is not assignable to type '{ [key: number]: string; }'. | ||
!!! error TS2322: Property '1' is incompatible with index signature. | ||
!!! error TS2322: Type 'string | undefined' is not assignable to type 'string'. | ||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'. | ||
|
||
declare let optionalUndefined: { k1?: undefined }; | ||
let dict: { [key: string]: string } = optionalUndefined; // error | ||
~~~~ | ||
!!! error TS2322: Type '{ k1?: undefined; }' is not assignable to type '{ [key: string]: string; }'. | ||
!!! error TS2322: Property 'k1' is incompatible with index signature. | ||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'. | ||
|
||
function f<T>() { | ||
let optional: { k1?: T } = undefined!; | ||
let dict: { [key: string]: T | number } = optional; // ok | ||
} | ||
|
Oops, something went wrong.