Skip to content

Maximum call stack when using typeof own namespace #6072

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

Closed
blakeembrey opened this issue Dec 11, 2015 · 0 comments
Closed

Maximum call stack when using typeof own namespace #6072

blakeembrey opened this issue Dec 11, 2015 · 0 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@blakeembrey
Copy link
Contributor

Minimal test should reproduce it (it did in the playground, confirmed it was not working with typescript@next locally):

class Foo {}

function maker (value: string): typeof maker.Bar {}

namespace maker {
    class Bar extends Foo {}
}

The stack trace locally:

/Users/blakeembrey/Projects/blakeembrey/make-error-cause/node_modules/typescript/lib/tsc.js:31991
                throw e;
                ^

RangeError: Maximum call stack size exceeded
    at checkPropertyAccessExpressionOrQualifiedName (/Users/blakeembrey/Projects/blakeembrey/make-error-cause/node_modules/typescript/lib/tsc.js:17864:62)
    at checkQualifiedName (/Users/blakeembrey/Projects/blakeembrey/make-error-cause/node_modules/typescript/lib/tsc.js:17862:20)
    at checkExpression (/Users/blakeembrey/Projects/blakeembrey/make-error-cause/node_modules/typescript/lib/tsc.js:19502:24)
    at getTypeFromTypeQueryNode (/Users/blakeembrey/Projects/blakeembrey/make-error-cause/node_modules/typescript/lib/tsc.js:14618:53)
    at getTypeFromTypeNode (/Users/blakeembrey/Projects/blakeembrey/make-error-cause/node_modules/typescript/lib/tsc.js:14907:28)
    at getSignatureFromDeclaration (/Users/blakeembrey/Projects/blakeembrey/make-error-cause/node_modules/typescript/lib/tsc.js:14332:34)
    at getSignaturesOfSymbol (/Users/blakeembrey/Projects/blakeembrey/make-error-cause/node_modules/typescript/lib/tsc.js:14373:37)
    at resolveAnonymousTypeMembers (/Users/blakeembrey/Projects/blakeembrey/make-error-cause/node_modules/typescript/lib/tsc.js:14029:38)
    at resolveStructuredTypeMembers (/Users/blakeembrey/Projects/blakeembrey/make-error-cause/node_modules/typescript/lib/tsc.js:14057:21)
    at getPropertyOfType (/Users/blakeembrey/Projects/blakeembrey/make-error-cause/node_modules/typescript/lib/tsc.js:14189:32)

Feel free to let me know if I'm trying to do something wrong, but it probably shouldn't crash anyway.

Edit: For additional information, it come from trying to type make-error (https://raw.githubusercontent.com/typings/typed-make-error/5a653400e91cf7046512544b7ed2ebab702b0183/index.d.ts). I noticed I had a bug when not using typeof, and that caused it to crash.

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Dec 11, 2015
@ahejlsberg ahejlsberg self-assigned this Dec 14, 2015
@ahejlsberg ahejlsberg added this to the TypeScript 1.8 milestone Dec 14, 2015
@ahejlsberg ahejlsberg added the Fixed A PR has been merged for this issue label Dec 14, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants