-
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.
Merge pull request #25565 from Microsoft/popFirst
Make 'pop' the first method that uses 'T' in 'Array'
- Loading branch information
Showing
14 changed files
with
186 additions
and
35 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
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
46 changes: 46 additions & 0 deletions
46
tests/baselines/reference/nestedRecursiveArraysOrObjectsError01.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,46 @@ | ||
tests/cases/compiler/nestedRecursiveArraysOrObjectsError01.ts(10,9): error TS2322: Type '{ foo: string; jj: number; }[][][]' is not assignable to type 'Style'. | ||
Type '{ foo: string; jj: number; }[][][]' is not assignable to type 'StyleArray'. | ||
Types of property 'pop' are incompatible. | ||
Type '() => { foo: string; jj: number; }[][]' is not assignable to type '() => Style'. | ||
Type '{ foo: string; jj: number; }[][]' is not assignable to type 'Style'. | ||
Type '{ foo: string; jj: number; }[][]' is not assignable to type 'StyleArray'. | ||
Types of property 'pop' are incompatible. | ||
Type '() => { foo: string; jj: number; }[]' is not assignable to type '() => Style'. | ||
Type '{ foo: string; jj: number; }[]' is not assignable to type 'Style'. | ||
Type '{ foo: string; jj: number; }[]' is not assignable to type 'StyleArray'. | ||
Types of property 'pop' are incompatible. | ||
Type '() => { foo: string; jj: number; }' is not assignable to type '() => Style'. | ||
Type '{ foo: string; jj: number; }' is not assignable to type 'Style'. | ||
Object literal may only specify known properties, and 'jj' does not exist in type 'Style'. | ||
|
||
|
||
==== tests/cases/compiler/nestedRecursiveArraysOrObjectsError01.ts (1 errors) ==== | ||
type Style = StyleBase | StyleArray; | ||
interface StyleArray extends Array<Style> {} | ||
interface StyleBase { | ||
foo: string; | ||
} | ||
|
||
const blah: Style = [ | ||
[[{ | ||
foo: 'asdf', | ||
jj: 1 // intentional error | ||
~~~~~ | ||
!!! error TS2322: Type '{ foo: string; jj: number; }[][][]' is not assignable to type 'Style'. | ||
!!! error TS2322: Type '{ foo: string; jj: number; }[][][]' is not assignable to type 'StyleArray'. | ||
!!! error TS2322: Types of property 'pop' are incompatible. | ||
!!! error TS2322: Type '() => { foo: string; jj: number; }[][]' is not assignable to type '() => Style'. | ||
!!! error TS2322: Type '{ foo: string; jj: number; }[][]' is not assignable to type 'Style'. | ||
!!! error TS2322: Type '{ foo: string; jj: number; }[][]' is not assignable to type 'StyleArray'. | ||
!!! error TS2322: Types of property 'pop' are incompatible. | ||
!!! error TS2322: Type '() => { foo: string; jj: number; }[]' is not assignable to type '() => Style'. | ||
!!! error TS2322: Type '{ foo: string; jj: number; }[]' is not assignable to type 'Style'. | ||
!!! error TS2322: Type '{ foo: string; jj: number; }[]' is not assignable to type 'StyleArray'. | ||
!!! error TS2322: Types of property 'pop' are incompatible. | ||
!!! error TS2322: Type '() => { foo: string; jj: number; }' is not assignable to type '() => Style'. | ||
!!! error TS2322: Type '{ foo: string; jj: number; }' is not assignable to type 'Style'. | ||
!!! error TS2322: Object literal may only specify known properties, and 'jj' does not exist in type 'Style'. | ||
}]] | ||
]; | ||
|
||
|
23 changes: 23 additions & 0 deletions
23
tests/baselines/reference/nestedRecursiveArraysOrObjectsError01.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,23 @@ | ||
//// [nestedRecursiveArraysOrObjectsError01.ts] | ||
type Style = StyleBase | StyleArray; | ||
interface StyleArray extends Array<Style> {} | ||
interface StyleBase { | ||
foo: string; | ||
} | ||
|
||
const blah: Style = [ | ||
[[{ | ||
foo: 'asdf', | ||
jj: 1 // intentional error | ||
}]] | ||
]; | ||
|
||
|
||
|
||
//// [nestedRecursiveArraysOrObjectsError01.js] | ||
var blah = [ | ||
[[{ | ||
foo: 'asdf', | ||
jj: 1 // intentional error | ||
}]] | ||
]; |
33 changes: 33 additions & 0 deletions
33
tests/baselines/reference/nestedRecursiveArraysOrObjectsError01.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,33 @@ | ||
=== tests/cases/compiler/nestedRecursiveArraysOrObjectsError01.ts === | ||
type Style = StyleBase | StyleArray; | ||
>Style : Symbol(Style, Decl(nestedRecursiveArraysOrObjectsError01.ts, 0, 0)) | ||
>StyleBase : Symbol(StyleBase, Decl(nestedRecursiveArraysOrObjectsError01.ts, 1, 44)) | ||
>StyleArray : Symbol(StyleArray, Decl(nestedRecursiveArraysOrObjectsError01.ts, 0, 36)) | ||
|
||
interface StyleArray extends Array<Style> {} | ||
>StyleArray : Symbol(StyleArray, Decl(nestedRecursiveArraysOrObjectsError01.ts, 0, 36)) | ||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) | ||
>Style : Symbol(Style, Decl(nestedRecursiveArraysOrObjectsError01.ts, 0, 0)) | ||
|
||
interface StyleBase { | ||
>StyleBase : Symbol(StyleBase, Decl(nestedRecursiveArraysOrObjectsError01.ts, 1, 44)) | ||
|
||
foo: string; | ||
>foo : Symbol(StyleBase.foo, Decl(nestedRecursiveArraysOrObjectsError01.ts, 2, 21)) | ||
} | ||
|
||
const blah: Style = [ | ||
>blah : Symbol(blah, Decl(nestedRecursiveArraysOrObjectsError01.ts, 6, 5)) | ||
>Style : Symbol(Style, Decl(nestedRecursiveArraysOrObjectsError01.ts, 0, 0)) | ||
|
||
[[{ | ||
foo: 'asdf', | ||
>foo : Symbol(foo, Decl(nestedRecursiveArraysOrObjectsError01.ts, 7, 7)) | ||
|
||
jj: 1 // intentional error | ||
>jj : Symbol(jj, Decl(nestedRecursiveArraysOrObjectsError01.ts, 8, 20)) | ||
|
||
}]] | ||
]; | ||
|
||
|
40 changes: 40 additions & 0 deletions
40
tests/baselines/reference/nestedRecursiveArraysOrObjectsError01.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,40 @@ | ||
=== tests/cases/compiler/nestedRecursiveArraysOrObjectsError01.ts === | ||
type Style = StyleBase | StyleArray; | ||
>Style : Style | ||
>StyleBase : StyleBase | ||
>StyleArray : StyleArray | ||
|
||
interface StyleArray extends Array<Style> {} | ||
>StyleArray : StyleArray | ||
>Array : T[] | ||
>Style : Style | ||
|
||
interface StyleBase { | ||
>StyleBase : StyleBase | ||
|
||
foo: string; | ||
>foo : string | ||
} | ||
|
||
const blah: Style = [ | ||
>blah : Style | ||
>Style : Style | ||
>[ [[{ foo: 'asdf', jj: 1 // intentional error }]]] : { foo: string; jj: number; }[][][] | ||
|
||
[[{ | ||
>[[{ foo: 'asdf', jj: 1 // intentional error }]] : { foo: string; jj: number; }[][] | ||
>[{ foo: 'asdf', jj: 1 // intentional error }] : { foo: string; jj: number; }[] | ||
>{ foo: 'asdf', jj: 1 // intentional error } : { foo: string; jj: number; } | ||
|
||
foo: 'asdf', | ||
>foo : string | ||
>'asdf' : "asdf" | ||
|
||
jj: 1 // intentional error | ||
>jj : number | ||
>1 : 1 | ||
|
||
}]] | ||
]; | ||
|
||
|
Oops, something went wrong.