-
Notifications
You must be signed in to change notification settings - Fork 12.8k
ts.TypeChecker.typeToTypeNode goes in infinite loop eating up CPU and Memory. #29564
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
Comments
@weswigham , it will be very helpful if you can guide me on this blocker issue.
|
As a workaround, I'd try setting |
If i do not pass |
Try gradually bumping up the |
it stops at the property at line 87 from the file attached.
|
That's with the default length, yeah? With a larger truncation length (eg, 1000), where's the truncation occur (that'll be more indicative of where the problem is when truncation is off)? |
Ya thats with the default length i guess. But i am not aware how to set |
In your code that's running this, just set |
Without setting the above value and without passing When i set If i bump the value of |
What's the actual display of this type? |
I am not sure what do u mean by display of this type? You could see the definition of this type in the file which i had attached. |
If you make a printer with `ts.createPrinter` and print the type, what's
the textual representation you get.
…On Thu, Jan 24, 2019 at 7:10 PM Abhijit Ashok Parkhi < ***@***.***> wrote:
I am not sure what do u mean by display of this type?
Its a ObjectLiteralExpression getting created, and the members are
properties/functions.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#29564 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACzAMiPIvIdvX0WmElm5j1XN4t4qAOxuks5vGnWrgaJpZM4aRfm8>
.
|
Hi @weswigham sorry for coming late over this. if so, by setting
the value we get in test is as below:
I am not sure if this is what you were looking out for. |
Ya. Looks like we're printing the |
Any ideas to go ahead with this problem ? |
Hmmm, well - if you explicitly give the return type with a type annotation of some kind it'll at least short circuit the printout. |
@sandersn I suspect this is identical to the issue you were looking at with js object printback and |
@abhijitparkhi1983 I've closed this, but if you could validate that your full example works in your local setup with our next nightly (ie, the nightly from anytime after tomorrow), that'd be swell. |
TypeScript Version: 3.2.2
Search Terms:
ts.TypeChecker.typeToTypeNode,
ts.TypeLiteralNode,
ts.NodeBuilderFlags.NoTruncation
Description:
We are trying to use typescript compiler for getting the type of ObjectLiteralExpression and for the purpose we utilize following code:
When we run the above code over the attached file SEA3DAmmo.txt (rename file to SEA3DAmmo.js), the line this.checker.typeToTypeNode goes into infinite loop and the application consumes high CPU and Memory and the call does not return back atall.
This is an absolute blocker, may be i am doing some mistake.
I also tried running with following options:
this.checker.typeToTypeNode(type, node, ts.NodeBuilderFlags.NoTruncation);
or
this.checker.typeToTypeNode(type, node.parent, ts.NodeBuilderFlags.NoTruncation);
Expected behavior:
It should return value and should not go in infinite loop.
SEA3DAmmo.txt
The text was updated successfully, but these errors were encountered: