Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(50591): RangeError: Maximum call stack size exceeded (#50594)
- Loading branch information
1 parent
168186f
commit 23746af
Showing
6 changed files
with
92 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
15 changes: 15 additions & 0 deletions
15
tests/baselines/reference/typeGuardNarrowsIndexedAccessOfKnownProperty10.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,15 @@ | ||
tests/cases/compiler/typeGuardNarrowsIndexedAccessOfKnownProperty10.ts(5,6): error TS2448: Block-scoped variable 'id' used before its declaration. | ||
|
||
|
||
==== tests/cases/compiler/typeGuardNarrowsIndexedAccessOfKnownProperty10.ts (1 errors) ==== | ||
interface Foo { bar: any; } | ||
const bar: { [id: string]: number } = {}; | ||
|
||
(foo: Foo) => { | ||
bar[id]++; | ||
~~ | ||
!!! error TS2448: Block-scoped variable 'id' used before its declaration. | ||
!!! related TS2728 tests/cases/compiler/typeGuardNarrowsIndexedAccessOfKnownProperty10.ts:6:8: 'id' is declared here. | ||
const id = foo.bar; | ||
} | ||
|
17 changes: 17 additions & 0 deletions
17
tests/baselines/reference/typeGuardNarrowsIndexedAccessOfKnownProperty10.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,17 @@ | ||
//// [typeGuardNarrowsIndexedAccessOfKnownProperty10.ts] | ||
interface Foo { bar: any; } | ||
const bar: { [id: string]: number } = {}; | ||
|
||
(foo: Foo) => { | ||
bar[id]++; | ||
const id = foo.bar; | ||
} | ||
|
||
|
||
//// [typeGuardNarrowsIndexedAccessOfKnownProperty10.js] | ||
"use strict"; | ||
var bar = {}; | ||
(function (foo) { | ||
bar[id]++; | ||
var id = foo.bar; | ||
}); |
24 changes: 24 additions & 0 deletions
24
tests/baselines/reference/typeGuardNarrowsIndexedAccessOfKnownProperty10.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,24 @@ | ||
=== tests/cases/compiler/typeGuardNarrowsIndexedAccessOfKnownProperty10.ts === | ||
interface Foo { bar: any; } | ||
>Foo : Symbol(Foo, Decl(typeGuardNarrowsIndexedAccessOfKnownProperty10.ts, 0, 0)) | ||
>bar : Symbol(Foo.bar, Decl(typeGuardNarrowsIndexedAccessOfKnownProperty10.ts, 0, 15)) | ||
|
||
const bar: { [id: string]: number } = {}; | ||
>bar : Symbol(bar, Decl(typeGuardNarrowsIndexedAccessOfKnownProperty10.ts, 1, 5)) | ||
>id : Symbol(id, Decl(typeGuardNarrowsIndexedAccessOfKnownProperty10.ts, 1, 14)) | ||
|
||
(foo: Foo) => { | ||
>foo : Symbol(foo, Decl(typeGuardNarrowsIndexedAccessOfKnownProperty10.ts, 3, 1)) | ||
>Foo : Symbol(Foo, Decl(typeGuardNarrowsIndexedAccessOfKnownProperty10.ts, 0, 0)) | ||
|
||
bar[id]++; | ||
>bar : Symbol(bar, Decl(typeGuardNarrowsIndexedAccessOfKnownProperty10.ts, 1, 5)) | ||
>id : Symbol(id, Decl(typeGuardNarrowsIndexedAccessOfKnownProperty10.ts, 5, 6)) | ||
|
||
const id = foo.bar; | ||
>id : Symbol(id, Decl(typeGuardNarrowsIndexedAccessOfKnownProperty10.ts, 5, 6)) | ||
>foo.bar : Symbol(Foo.bar, Decl(typeGuardNarrowsIndexedAccessOfKnownProperty10.ts, 0, 15)) | ||
>foo : Symbol(foo, Decl(typeGuardNarrowsIndexedAccessOfKnownProperty10.ts, 3, 1)) | ||
>bar : Symbol(Foo.bar, Decl(typeGuardNarrowsIndexedAccessOfKnownProperty10.ts, 0, 15)) | ||
} | ||
|
26 changes: 26 additions & 0 deletions
26
tests/baselines/reference/typeGuardNarrowsIndexedAccessOfKnownProperty10.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,26 @@ | ||
=== tests/cases/compiler/typeGuardNarrowsIndexedAccessOfKnownProperty10.ts === | ||
interface Foo { bar: any; } | ||
>bar : any | ||
|
||
const bar: { [id: string]: number } = {}; | ||
>bar : { [id: string]: number; } | ||
>id : string | ||
>{} : {} | ||
|
||
(foo: Foo) => { | ||
>(foo: Foo) => { bar[id]++; const id = foo.bar;} : (foo: Foo) => void | ||
>foo : Foo | ||
|
||
bar[id]++; | ||
>bar[id]++ : number | ||
>bar[id] : number | ||
>bar : { [id: string]: number; } | ||
>id : any | ||
|
||
const id = foo.bar; | ||
>id : any | ||
>foo.bar : any | ||
>foo : Foo | ||
>bar : any | ||
} | ||
|
9 changes: 9 additions & 0 deletions
9
tests/cases/compiler/typeGuardNarrowsIndexedAccessOfKnownProperty10.ts
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 @@ | ||
// @strict: true | ||
|
||
interface Foo { bar: any; } | ||
const bar: { [id: string]: number } = {}; | ||
|
||
(foo: Foo) => { | ||
bar[id]++; | ||
const id = foo.bar; | ||
} |