Typescript 4.5.2: Cannot read property 'impliedNodeFormat' of undefined
adrianbw opened this issue · comments
I've got several react/typescript repositories using ttypescript that have started throwing this error since our upgrade to 4.5.2. I haven't been able to isolate what the cause is, though. Unfortunately, I'm also going to be no longer at the company with this problem in about two hours, but I wanted to make sure this was noted.
also having this issue. Stacktrace:
if (file.impliedNodeFormat === undefined)
^
TypeError: Cannot read properties of undefined (reading 'impliedNodeFormat')
at Object.getModeForUsageLocation ([PATH]/node_modules/typescript/lib/typescript.js:113474:18)
at resolveExternalModule ([PATH]/node_modules/typescript/lib/typescript.js:49819:90)
at resolveExternalModuleNameWorker ([PATH]/node_modules/typescript/lib/typescript.js:49795:19)
at getExternalModuleFileFromDeclaration ([PATH]/node_modules/typescript/lib/typescript.js:85155:32)
at Object.getExternalModuleFileFromDeclaration ([PATH]/node_modules/typescript/lib/typescript.js:84994:36)
at tryGetModuleNameFromDeclaration ([PATH]/node_modules/typescript/lib/typescript.js:29322:59)
at Object.getExternalModuleNameLiteral ([PATH]/node_modules/typescript/lib/typescript.js:29286:20)
at createRequireCall ([PATH]/node_modules/typescript/lib/typescript.js:102481:33)
at visitImportDeclaration ([PATH]/node_modules/typescript/lib/typescript.js:102441:80)
at topLevelVisitor ([PATH]/node_modules/typescript/lib/typescript.js:102090:28)`
Same issue when upgrading from 4.4.x to 4.5.x version of typescript
This may be an issue with a plugin you're using rather than an issue with ttsc
per se.
I only use ttsc
to get access to this plugin: @zerollup/ts-transform-paths
so I can resolve absolute paths at typescript build time.
I was experiencing the same issue described above, but the patch-package
solution described zerkalica/zerollup#37 fixed my issue. Hopefully helps you as well.
Bless you, thanks.