-
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.
Types that extend Array or ReadonlyArray are automatically array-like
- Loading branch information
1 parent
322c70f
commit 684b039
Showing
5 changed files
with
84 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//// [excessiveStackDepthFlatArray.ts] | ||
interface MiddlewareArray<T> extends Array<T> {} | ||
declare function configureStore(options: { middleware: MiddlewareArray<any> }): void; | ||
|
||
declare const defaultMiddleware: MiddlewareArray<any>; | ||
configureStore({ | ||
middleware: [...defaultMiddleware], // Should not error | ||
}); | ||
|
||
|
||
//// [excessiveStackDepthFlatArray.js] | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
configureStore({ | ||
middleware: __spreadArray([], defaultMiddleware) | ||
}); |
26 changes: 26 additions & 0 deletions
26
tests/baselines/reference/excessiveStackDepthFlatArray.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,26 @@ | ||
=== tests/cases/compiler/excessiveStackDepthFlatArray.ts === | ||
interface MiddlewareArray<T> extends Array<T> {} | ||
>MiddlewareArray : Symbol(MiddlewareArray, Decl(excessiveStackDepthFlatArray.ts, 0, 0)) | ||
>T : Symbol(T, Decl(excessiveStackDepthFlatArray.ts, 0, 26)) | ||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) | ||
>T : Symbol(T, Decl(excessiveStackDepthFlatArray.ts, 0, 26)) | ||
|
||
declare function configureStore(options: { middleware: MiddlewareArray<any> }): void; | ||
>configureStore : Symbol(configureStore, Decl(excessiveStackDepthFlatArray.ts, 0, 48)) | ||
>options : Symbol(options, Decl(excessiveStackDepthFlatArray.ts, 1, 32)) | ||
>middleware : Symbol(middleware, Decl(excessiveStackDepthFlatArray.ts, 1, 42)) | ||
>MiddlewareArray : Symbol(MiddlewareArray, Decl(excessiveStackDepthFlatArray.ts, 0, 0)) | ||
|
||
declare const defaultMiddleware: MiddlewareArray<any>; | ||
>defaultMiddleware : Symbol(defaultMiddleware, Decl(excessiveStackDepthFlatArray.ts, 3, 13)) | ||
>MiddlewareArray : Symbol(MiddlewareArray, Decl(excessiveStackDepthFlatArray.ts, 0, 0)) | ||
|
||
configureStore({ | ||
>configureStore : Symbol(configureStore, Decl(excessiveStackDepthFlatArray.ts, 0, 48)) | ||
|
||
middleware: [...defaultMiddleware], // Should not error | ||
>middleware : Symbol(middleware, Decl(excessiveStackDepthFlatArray.ts, 4, 16)) | ||
>defaultMiddleware : Symbol(defaultMiddleware, Decl(excessiveStackDepthFlatArray.ts, 3, 13)) | ||
|
||
}); | ||
|
23 changes: 23 additions & 0 deletions
23
tests/baselines/reference/excessiveStackDepthFlatArray.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,23 @@ | ||
=== tests/cases/compiler/excessiveStackDepthFlatArray.ts === | ||
interface MiddlewareArray<T> extends Array<T> {} | ||
declare function configureStore(options: { middleware: MiddlewareArray<any> }): void; | ||
>configureStore : (options: { middleware: MiddlewareArray<any>;}) => void | ||
>options : { middleware: MiddlewareArray<any>; } | ||
>middleware : MiddlewareArray<any> | ||
|
||
declare const defaultMiddleware: MiddlewareArray<any>; | ||
>defaultMiddleware : MiddlewareArray<any> | ||
|
||
configureStore({ | ||
>configureStore({ middleware: [...defaultMiddleware], // Should not error}) : void | ||
>configureStore : (options: { middleware: MiddlewareArray<any>; }) => void | ||
>{ middleware: [...defaultMiddleware], // Should not error} : { middleware: any[]; } | ||
|
||
middleware: [...defaultMiddleware], // Should not error | ||
>middleware : any[] | ||
>[...defaultMiddleware] : any[] | ||
>...defaultMiddleware : any | ||
>defaultMiddleware : MiddlewareArray<any> | ||
|
||
}); | ||
|
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,9 @@ | ||
// @lib: es2019 | ||
|
||
interface MiddlewareArray<T> extends Array<T> {} | ||
declare function configureStore(options: { middleware: MiddlewareArray<any> }): void; | ||
|
||
declare const defaultMiddleware: MiddlewareArray<any>; | ||
configureStore({ | ||
middleware: [...defaultMiddleware], // Should not error | ||
}); |