-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Closed
Copy link
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
function sum<T extends { [P in T]: number }, K extends keyof T>() {
n += v[k];
}
This incorrect code puts the compiler in an infinite loop:
RangeError: Maximum call stack size exceeded
at Object.contains (src/compiler/core.ts:276:5)
at getBaseConstraint (src/compiler/checker.ts:5955:21)
at getResolvedBaseConstraint (src/compiler/checker.ts:5949:36)
at hasNonCircularBaseConstraint (src/compiler/checker.ts:5936:20)
at getConstraintOfTypeParameter (src/compiler/checker.ts:5906:20)
at getConstraintTypeFromMappedType (src/compiler/checker.ts:5761:56)
at isGenericMappedType (src/compiler/checker.ts:5798:84)
at computeBaseConstraint (src/compiler/checker.ts:5997:21)
at getBaseConstraint (src/compiler/checker.ts:5960:32)
at computeBaseConstraint (src/compiler/checker.ts:5969:38)
at getBaseConstraint (src/compiler/checker.ts:5960:32)
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue