-
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.
Put error spans deep on nested object literals (#25140)
* Add ncie deep elaborations * Nice stuff * Modify tuple error to use length error mroe often * Accept good baselines * Accept meh baselines * Fix literal types * Calculate elaborations like it was the very first time again~ * Use tristate for enum relationship to ensure elaborations are printed at least once * Update message text, nits * move some functions back to where they were * Add test of deep JSX elaboration * Add elaboration test with parenthesized expressions, comma expressions, and assignments * Move check to allow elaborations on more anonymous types * Fix nits * Add specialized error to elaborations of nonliteral computed named-members * Update error message
- Loading branch information
Showing
85 changed files
with
1,388 additions
and
706 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"compilerOptions": { | ||
"pretty": true, | ||
"lib": ["es5"], | ||
"lib": ["es2015"], | ||
"target": "es5", | ||
|
||
"declaration": true, | ||
|
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
19 changes: 9 additions & 10 deletions
19
tests/baselines/reference/computedPropertyNamesContextualType8_ES5.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 |
---|---|---|
@@ -1,21 +1,20 @@ | ||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'. | ||
Index signatures are incompatible. | ||
Type 'string | number' is not assignable to type 'boolean'. | ||
Type 'string' is not assignable to type 'boolean'. | ||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(7,5): error TS2418: Type of computed property's value is 'string', which is not assignable to type 'boolean'. | ||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(8,5): error TS2418: Type of computed property's value is 'number', which is not assignable to type 'boolean'. | ||
|
||
|
||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts (1 errors) ==== | ||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts (2 errors) ==== | ||
interface I { | ||
[s: string]: boolean; | ||
[s: number]: boolean; | ||
} | ||
|
||
var o: I = { | ||
~ | ||
!!! error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'. | ||
!!! error TS2322: Index signatures are incompatible. | ||
!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. | ||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'. | ||
[""+"foo"]: "", | ||
~~~~~~~~~~ | ||
!!! error TS2418: Type of computed property's value is 'string', which is not assignable to type 'boolean'. | ||
!!! related TS6501 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts:2:5: The expected type comes from this index signature. | ||
[""+"bar"]: 0 | ||
~~~~~~~~~~ | ||
!!! error TS2418: Type of computed property's value is 'number', which is not assignable to type 'boolean'. | ||
!!! related TS6501 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts:2:5: The expected type comes from this index signature. | ||
} |
19 changes: 9 additions & 10 deletions
19
tests/baselines/reference/computedPropertyNamesContextualType8_ES6.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 |
---|---|---|
@@ -1,21 +1,20 @@ | ||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts(6,5): error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'. | ||
Index signatures are incompatible. | ||
Type 'string | number' is not assignable to type 'boolean'. | ||
Type 'string' is not assignable to type 'boolean'. | ||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts(7,5): error TS2418: Type of computed property's value is 'string', which is not assignable to type 'boolean'. | ||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts(8,5): error TS2418: Type of computed property's value is 'number', which is not assignable to type 'boolean'. | ||
|
||
|
||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts (1 errors) ==== | ||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts (2 errors) ==== | ||
interface I { | ||
[s: string]: boolean; | ||
[s: number]: boolean; | ||
} | ||
|
||
var o: I = { | ||
~ | ||
!!! error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'. | ||
!!! error TS2322: Index signatures are incompatible. | ||
!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. | ||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'. | ||
[""+"foo"]: "", | ||
~~~~~~~~~~ | ||
!!! error TS2418: Type of computed property's value is 'string', which is not assignable to type 'boolean'. | ||
!!! related TS6501 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts:2:5: The expected type comes from this index signature. | ||
[""+"bar"]: 0 | ||
~~~~~~~~~~ | ||
!!! error TS2418: Type of computed property's value is 'number', which is not assignable to type 'boolean'. | ||
!!! related TS6501 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts:2:5: The expected type comes from this index signature. | ||
} |
Oops, something went wrong.