-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Put error spans deep on nested object literals #25140
Changes from 21 commits
91d292d
4303c00
c463bd5
5733e3f
167ec23
f832eae
36206c8
c8fc8db
f52c9b9
ea3300a
23d1e17
4a757fa
10b1292
e663505
7b83484
b819165
1bcf91e
9eb759b
62ba57c
7a344f5
dcbf33a
ae46816
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1452,6 +1452,10 @@ | |
"category": "Error", | ||
"code": 2417 | ||
}, | ||
"Type of computed property value is '{0}', which is not assignable to type '{1}'.": { | ||
"category": "Error", | ||
"code": 2418 | ||
}, | ||
"Class '{0}' incorrectly implements interface '{1}'.": { | ||
"category": "Error", | ||
"code": 2420 | ||
|
@@ -3746,6 +3750,15 @@ | |
"code": 6371 | ||
}, | ||
|
||
"The expected type comes from property '{0}' which is declared here on type '{1}'": { | ||
"category": "Message", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought it was "category": "Error" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed duing our sync earlier, right now the category is unused for related information - we can put off deciding why they aughta be until we have a story for using them in some principled way (for, eg, elaborations vs explanations) |
||
"code": 6500 | ||
}, | ||
"The expected type comes from this index signature.": { | ||
"category": "Message", | ||
"code": 6501 | ||
}, | ||
|
||
"Variable '{0}' implicitly has an '{1}' type.": { | ||
"category": "Error", | ||
"code": 7005 | ||
|
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, | ||
|
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 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 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 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 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. | ||
} |
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 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 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 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 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. | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
computed property's