- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version:  2.4.0 onwards
Code
export interface Foo<T> {
  (bar: Bar<T>): void;
}
export interface Bar<T> {
  (foo: Foo<T>): Foo<T>;
}
function createBar<T>(): Bar<T> {
  return (f) => f;
}
function foo<T>(
  bar: Bar<T>,
): void {}
// Stack overflow
createBar()(foo) === foo;Simplified down from a real code-base.
Expected behavior:
Compiles fine, as per < 2.3.4
Actual behavior:
With 2.4.0 (same behaviour with 2.5.2):
$ ./node_modules/.bin/tsc example.ts
./node_modules/typescript/lib/tsc.js:55708
                throw e;
                ^
RangeError: Maximum call stack size exceeded
    at getErasedSignature (.../node_modules/typescript/lib/tsc.js:27019:36)
    at compareSignaturesRelated (.../node_modules/typescript/lib/tsc.js:28517:22)
    at compareSignaturesRelated (.../node_modules/typescript/lib/tsc.js:28548:21)
    at compareSignaturesRelated (.../node_modules/typescript/lib/tsc.js:28548:21)
    at compareSignaturesRelated (.../node_modules/typescript/lib/tsc.js:28548:21)
    at compareSignaturesRelated (.../node_modules/typescript/lib/tsc.js:28548:21)
    at compareSignaturesRelated (.../node_modules/typescript/lib/tsc.js:28548:21)
    at compareSignaturesRelated (.../node_modules/typescript/lib/tsc.js:28548:21)
    at compareSignaturesRelated (.../node_modules/typescript/lib/tsc.js:28548:21)
    at compareSignaturesRelated (.../node_modules/typescript/lib/tsc.js:28548:21)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