N
N
Nikita Sokolov2020-07-17 09:49:01
typescript
Nikita Sokolov, 2020-07-17 09:49:01

How to fix TypeScript compilation error?

For a long time I did not study ts and for a long time I forgot what and where. Now it is necessary to return to my old craft... When assembling the project, everything is clearly assembled - no problems, but if you run npm testit for some reason, it gives out this:

TSError: ⨯ Unable to compile TypeScript:
src/plugin/modules/model.ts:7:13 - error TS2304: Cannot find name 'Settings'.

settings: Settings = {

The script itself npm testexecutes the following commands:

[email protected] test /Users/nikita/Desktop/работа/FSD-plugin
mocha -r ts-node/register src/plugin/tests/*.ts

I posted the whole project on github: https://github.com/burningyouth/FSD-plugin

Maybe someone knows what the problem is? Why does not see interfaces? I have them in src/plugin/@typesand during normal assembly everything is OK, but the tests do not work. It seems to me that the problem is that when compiling @types is taken into account, but not when testing. I'm clearly missing something, and the obvious, but I don't understand what.

UPD: Tests work if you remove the Settings interface. And if this interface is put directly into a file, then everything is OK ... So mocha simply does not see my interfaces.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question