跳到主要内容
版本:0.17.0+

ts

  1. PASS: TS1259: Module '"path"' can only be default-imported using the 'esModuleInterop' flag
  2. ✅ tsc not work, tsc -b --clean not work too
  3. ☑️ TS4023 error of using (Database) name from external module (pass)

PASS: TS1259: Module '"path"' can only be default-imported using the 'esModuleInterop' flag

In my tsconfig.json file, there is already one flag of esModuleInterop set to be true.

However, this error still arises up when I use tsc.

✅ tsc not work, tsc -b --clean not work too

  1. The most important key causing this problem(indeed: a 假象) is outDir, since when it is set, all the compiled files would go to there, thus gives us an illusion that nothing happened.
  2. Besides, since tsc is possible to create many files, the IDE would not show there in time, you should use reload on the target output directory if necessary.
  3. When using tsc -b --clean, it also concerns with the outDir, and only have effects on this, the one difference is that the command would delete files, but except directories, so an empty directories construct would be shown.
picture 25

☑️ TS4023 error of using (Database) name from external module (pass)

I am pretty a newbie to typescript so I wonder what does this error mean and how to solve it?

picture 17

I tried to modify source code of better-sqlite3, and it works -- the error goes.

picture 16

Although both circumstances would have no effect on the codes run, I do wanna run with no compile warning or errors.

And even // @ts-ignore can not suppress this...

picture 18

If the only solution is to modify the source code of better-sqlite3, please do it!

And if in case I missed something, or do things not right, please correct me!

Much thanks!