cevek / ttypescript

Over TypeScript tool to use custom transformers in the tsconfig.json
1.53k stars 56 forks source link

Typescript 4.5.2: Cannot read property 'impliedNodeFormat' of undefined #125

Closed adrianbw closed 2 years ago

adrianbw commented 2 years ago

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.

MR4online commented 2 years ago

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)`
vdineva commented 2 years ago

Same issue when upgrading from 4.4.x to 4.5.x version of typescript

skilbjo commented 2 years ago

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 https://github.com/zerkalica/zerollup/issues/37 fixed my issue. Hopefully helps you as well.

adrianbw commented 2 years ago

Bless you, thanks.