cevek / ttypescript

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

Cannot read property 'updateImportDeclaration' of undefined #111

Closed tavisca-kbobade closed 3 years ago

tavisca-kbobade commented 3 years ago

I created a simple transformer to replace file content. But getting an error Cannot read property 'updateImportDeclaration' of undefined. It is because context.factory is null when I am using typescript@3.8.3 and when I install typescript@4.1.2 it works as expected.

Is there any other way instead of upgrading to typescript?

tavisca-kbobade commented 3 years ago

Closing this, as I think it is not related to ttypescript.

nonara commented 3 years ago

@tavisca-kbobade API functionality in TS pre-TS 4 is called through the Typescript instance.

ts 3: ts.updateImportDeclaration ts 4+: factory.updateImportDeclaration