-
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.
- Loading branch information
Showing
13 changed files
with
744 additions
and
96 deletions.
There are no files selected for viewing
19 changes: 9 additions & 10 deletions
19
tests/baselines/reference/computedPropertyNamesContextualType9_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/computedPropertyNamesContextualType9_ES5.ts(6,5): error TS2322: Type '{ [x: number]: 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/computedPropertyNamesContextualType9_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/computedPropertyNamesContextualType9_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/computedPropertyNamesContextualType9_ES5.ts (1 errors) ==== | ||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts (2 errors) ==== | ||
interface I { | ||
[s: string]: boolean; | ||
[s: number]: boolean; | ||
} | ||
|
||
var o: I = { | ||
~ | ||
!!! error TS2322: Type '{ [x: number]: 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/computedPropertyNamesContextualType9_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/computedPropertyNamesContextualType9_ES5.ts:2:5: The expected type comes from this index signature. | ||
} |
19 changes: 9 additions & 10 deletions
19
tests/baselines/reference/computedPropertyNamesContextualType9_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/computedPropertyNamesContextualType9_ES6.ts(6,5): error TS2322: Type '{ [x: number]: 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/computedPropertyNamesContextualType9_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/computedPropertyNamesContextualType9_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/computedPropertyNamesContextualType9_ES6.ts (1 errors) ==== | ||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts (2 errors) ==== | ||
interface I { | ||
[s: string]: boolean; | ||
[s: number]: boolean; | ||
} | ||
|
||
var o: I = { | ||
~ | ||
!!! error TS2322: Type '{ [x: number]: 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/computedPropertyNamesContextualType9_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/computedPropertyNamesContextualType9_ES6.ts:2:5: The expected type comes from this index signature. | ||
} |
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
31 changes: 0 additions & 31 deletions
31
tests/baselines/reference/deferredLookupTypeResolution2.errors.txt
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
tests/baselines/reference/indexedAccessRelation.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,37 @@ | ||
tests/cases/compiler/indexedAccessRelation.ts(16,23): error TS2345: Argument of type '{ a: T; }' is not assignable to parameter of type 'Pick<S & State<T>, "a">'. | ||
Types of property 'a' are incompatible. | ||
Type 'T' is not assignable to type 'S["a"] & T'. | ||
Type 'Foo' is not assignable to type 'S["a"] & T'. | ||
Type 'Foo' is not assignable to type 'S["a"]'. | ||
Type 'T' is not assignable to type 'S["a"]'. | ||
Type 'Foo' is not assignable to type 'S["a"]'. | ||
|
||
|
||
==== tests/cases/compiler/indexedAccessRelation.ts (1 errors) ==== | ||
// Repro from #14723 | ||
|
||
class Component<S> { | ||
setState<K extends keyof S>(state: Pick<S, K>) {} | ||
} | ||
|
||
export interface State<T> { | ||
a?: T; | ||
} | ||
|
||
class Foo {} | ||
|
||
class Comp<T extends Foo, S> extends Component<S & State<T>> | ||
{ | ||
foo(a: T) { | ||
this.setState({ a: a }); | ||
~~~~~~~~ | ||
!!! error TS2345: Argument of type '{ a: T; }' is not assignable to parameter of type 'Pick<S & State<T>, "a">'. | ||
!!! error TS2345: Types of property 'a' are incompatible. | ||
!!! error TS2345: Type 'T' is not assignable to type 'S["a"] & T'. | ||
!!! error TS2345: Type 'Foo' is not assignable to type 'S["a"] & T'. | ||
!!! error TS2345: Type 'Foo' is not assignable to type 'S["a"]'. | ||
!!! error TS2345: Type 'T' is not assignable to type 'S["a"]'. | ||
!!! error TS2345: Type 'Foo' is not assignable to type 'S["a"]'. | ||
} | ||
} | ||
|
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
Oops, something went wrong.