Description
Bug Report
π Search Terms
π Version & Regression Information
- This is a crash
- This changed between versions 4.6.4 and 4.7.2
β― Playground Link
Playground link with relevant code
π» Code
interface Request {
body: any
}
const x: { [uuid: string]: number } = {};
(req: Request) => {
x[uuid]++;
const uuid = req.body.common_name;
}
π Actual behavior
RangeError: Maximum call stack size exceeded
at resolveNameHelper (C:\ts-test\node_modules\typescript\lib\tsc.js:41378:21)
at resolveName (C:\ts-test\node_modules\typescript\lib\tsc.js:41165:20)
at resolveEntityName (C:\ts-test\node_modules\typescript\lib\tsc.js:42315:42)
at tryGetElementAccessExpressionName (C:\ts-test\node_modules\typescript\lib\tsc.js:58553:30)
at getAccessedPropertyName (C:\ts-test\node_modules\typescript\lib\tsc.js:58533:24)
at isMatchingReference (C:\ts-test\node_modules\typescript\lib\tsc.js:58516:78)
at getTypeAtFlowAssignment (C:\ts-test\node_modules\typescript\lib\tsc.js:59549:21)
at getTypeAtFlowNode (C:\ts-test\node_modules\typescript\lib\tsc.js:59476:32)
at getFlowTypeOfReference (C:\ts-test\node_modules\typescript\lib\tsc.js:59440:51)
at getFlowTypeOfAccessExpression (C:\ts-test\node_modules\typescript\lib\tsc.js:63184:28)
π Expected behavior
The error message:
Block-scoped variable 'uuid' used before its declaration.ts(2448)