-
Notifications
You must be signed in to change notification settings - Fork 56
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
ttsc -watch crashing when regenerating files #92
Comments
@oaosman84 Do you have any repro project? |
I am encountering the same issue |
same issue: : ts.skipTrivia(sourceFile.text, errorNode.pos);
^
TypeError: Cannot read property 'text' of undefined
at getErrorSpanForNode (/report/node_modules/typescript/lib/typescript.js:13660:40)
at createDiagnosticForNodeInSourceFile (/report/node_modules/typescript/lib/typescript.js:13564:20)
at Object.createDiagnosticForNode (/report/node_modules/typescript/lib/typescript.js:13555:16)
at error (/Users/shein/report/node_modules/typescript/lib/typescript.js:43205:22)
at resolveExternalModule (/report/node_modules/typescript/lib/typescript.js:45212:25)
at resolveExternalModuleNameWorker (/report/node_modules/typescript/lib/typescript.js:45129:19)
at resolveExternalModuleName (/report/node_modules/typescript/lib/typescript.js:45124:20)
at checkImportDeclaration (/report/node_modules/typescript/lib/typescript.js:74645:49)
at checkSourceElementWorker (/report/node_modules/typescript/lib/typescript.js:75078:28)
at checkSourceElement (/report/node_modules/typescript/lib/typescript.js:74911:17) |
Not sure what's happening here, but here's my 2 cents from my own experience and reports from others. Generally these types of errors come from modifying nodes incorrectly. In other words not using the API - ie. directly modifying properties, replacing nodes by assignment, etc. We can sometimes get away with hacks like that during a one-shot transformation, but watch mode actively maintains the AST and all of the trivia and diagnostics associated. Circumventing the API causes it to break down as its references are mismatched. If either of you can create a minimal reproduction, I'd be happy to have a look. |
@nonara I found my problem because of the use of |
@Val-istar-Guo Haha. Yep, that'd do it then. We're using a workaround which directly replaces a node due to a TS compiler issue. Really hoping TS fixes the upstream issue so I can close that. I'm monitoring closely. If TS doesn't fix it by v4.2.0, I'll find another way or do a PR on TS. Meanwhile, I suggest using v1 for now and follow that issue. |
@Val-istar-Guo I had some time to dig into the new compiler API, and I believe the issue should be resolved. If you have a chance to try v2.0.3, I'd appreciate it if you let me know if it works for you! |
@nonara Unfortunately, the error did not go away
Operating procedures
|
@Val-istar-Guo thanks for following up. There may not be anything that we can do until TS fixes the upstream. Would you mind filing an issue with the problem and repro steps on the GH issues for typescript-transform-paths? When you do, I'll look into it and you can track what's going on there. |
Hey,
We use
ttsc -watch
, and when I regenerate some files (using Apollo's code type generator), the compiler crashes. Though the stack trace is coming from typescript, this doesn't seem to happen with normaltsc - watch
.The text was updated successfully, but these errors were encountered: