You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Node#getText() will throw if node was made with another transformer #24273
When a transformers adds a new node to the AST, reading that node text will throw an error because sourceFile is not reflecting the newly added node TypeScript Version: 2.9.0
home/travis/build/mohsen1/ts-transformer-bug/node_modules/typescript/lib/typescript.js:102266
ts.Debug.assert(!ts.positionIsSynthesized(this.pos) && !ts.positionIsSynthesized(this.end), message || "Node must have a real position for this operation");
changed the title [-]Node#getText() will throw if node was made with a tranformer[/-][+]Node#getText() will throw if node was made with another transformer[/+]on May 20, 2018
C:\Throwaway\ts-transformer-bug\node_modules\typescript\lib\typescript.js:13089
return node.kind === 272 /* SourceFile */;
^
TypeError: Cannot read property 'kind' of undefined
at Object.isSourceFile (C:\Throwaway\ts-transformer-bug\node_modules\typescript\lib\typescript.js:13089:21)
at Object.printNode (C:\Throwaway\ts-transformer-bug\node_modules\typescript\lib\typescript.js:72638:40)
at compile (C:\Throwaway\ts-transformer-bug\dist\index.js:28:27)
at Object.<anonymous> (C:\Throwaway\ts-transformer-bug\dist\index.js:53:1)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow.
Activity
[-]Node#getText() will throw if node was made with a tranformer[/-][+]Node#getText() will throw if node was made with another transformer[/+]RyanCavanaugh commentedon May 21, 2018
Have you tried calling
getTextOfNodeinstead?mohsen1 commentedon May 22, 2018
I don't see
getTextOfNodeexported intypescript.d.ts.mohsen1/ts-transformer-bug#1
mohsen1 commentedon May 29, 2018
Ryan Cavanaugh (@RyanCavanaugh) Can you take a look?
RyanCavanaugh commentedon May 29, 2018
Mohsen Azimi (@mohsen1) this call stack doesn't look related to what you were describing?
mohsen1 commentedon Jun 9, 2018
Ryan Cavanaugh (@RyanCavanaugh) Not sure how you got
Cannot read property 'kind' of undefinedPlease runyarn testornpm test.I'm still not able to read text of a synthetically added node.
typescript-bot commentedon Jul 13, 2019
This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow.