Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Maximum call stack size exceeded" with recursive type parameter default #17049

Closed
WasabiFan opened this issue Jul 10, 2017 · 2 comments
Closed

Comments

@WasabiFan
Copy link

TypeScript Version: 2.3.4, 2.4.1

Code

class TestClass<T = TestClass> {

}

Expected behavior:

The code compiles such that I could reference the type in any of the following ways:

TestClass
TestClass<TestClass>
TestClass<MyOtherTestClassImplementation>

Actual behavior (v2.3.4):

C:\Users\user\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:53887
                throw e;
                ^

RangeError: Maximum call stack size exceeded
    at Map.get (native)
    at getSymbol (C:\Users\user\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:21268:38)
    at resolveName (C:\Users\user\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:21453:38)
    at resolveEntityName (C:\Users\user\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:21881:26)
    at getTypeFromTypeReference (C:\Users\user\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:26096:54)
    at getTypeFromTypeNode (C:\Users\user\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:26880:28)
    at getDefaultFromTypeParameter (C:\Users\user\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:25333:66)
    at getMinTypeArgumentCount (C:\Users\user\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:25585:26)
    at getTypeFromClassOrInterfaceReference (C:\Users\user\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:25955:44)
    at getTypeFromTypeReference (C:\Users\user\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:26098:52)

Presumably this was introduced in #13487.

@ikatyang
Copy link
Contributor

It seems duplicate of #16533.

@WasabiFan
Copy link
Author

Good catch. My searches for "generic" and "generics" didn't match up with the terms used over in that issue.

@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants