If I include the `.ts` extension, typescript will complain: ``` TS2691: An import path cannot end with a '.ts' extension ``` If I don't include the `.ts` extension, ts-node will complain: ``` throw new ERR_MODULE_NOT_FOUND( ^ CustomError: Cannot find module ``` Why is this? Why does it work fine for tsc but not ts-node?
Activity
cspotcode commentedon Apr 29, 2022
It doesn't work fine for tsc though, since you get that error.
https://devblogs.microsoft.com/typescript/announcing-typescript-4-7-beta/#type-in-package-json-and-new-extensions
TSC's rule is that it has to be the emitted extension, so it has to be
.js. ts-node does the right thing to make this work.