Typescript正在检查js文件以及ts

时间:2019-12-06 17:26:10

标签: javascript reactjs typescript

我不知道为什么会这样,但是我的React服务器突然报告了js上由打字稿编译的文件上的所有这些警告:

./src/actions/settings.actions.js
  Line 1:     'use strict' is unnecessary inside of modules  strict
  Line 30:   Unexpected use of comma operator               no-sequences
  Line 35:   Unexpected use of comma operator               no-sequences
  Line 36:   Unexpected use of comma operator               no-sequences
  Line 132:  Expected a default case                        default-case
  Line 157:  Expected a default case                        default-case
  Line 163:  Expected a 'break' statement before 'case'     no-fallthrough
  Line 164:  Unexpected comma in middle of array            no-sparse-arrays

./src/reducers/index.reducer.js
  Line 1:  'use strict' is unnecessary inside of modules  strict

./src/reducers/settingsMeta.reducer.js
  Line 1:  'use strict' is unnecessary inside of modules  strict

./src/reducers/settings.reducer.js
  Line 1:  'use strict' is unnecessary inside of modules  strict

./src/reducers/study.reducer.js
  Line 1:  'use strict' is unnecessary inside of modules  strict

./src/reducers/calculate.reducer.js
  Line 1:  'use strict' is unnecessary inside of modules  strict

./src/reducers/data.reducer.js
  Line 1:  'use strict' is unnecessary inside of modules  strict

./src/reducers/meta.reducer.js
  Line 1:  'use strict' is unnecessary inside of modules  strict

./src/actions/data.actions.js
  Line 1:  'use strict' is unnecessary inside of modules  strict

./src/types/redux.types.js
  Line 1:  'use strict' is unnecessary inside of modules  strict

./src/urls.js
  Line 1:  'use strict' is unnecessary inside of modules  strict

./src/types/settings.types.js
  Line 1:  'use strict' is unnecessary inside of modules  strict

除了js文件以外,Cypress还检测到ts个文件,并且报告了我的tsx个文件中的一堆错误,并且cypress无法运行:

./src/types/redux.types.ts
Module build failed (from ./node_modules/ts-loader/index.js):
Error: TypeScript emitted no output for C:\Users\jtuzman\dev\NOUS\front_end\src\types\redux.types.ts.
    at makeSourceMapAndFinish (C:\Users\jtuzman\dev\NOUS\front_end\node_modules\ts-loader\dist\index.js:80:15)
    at successLoader (C:\Users\jtuzman\dev\NOUS\front_end\node_modules\ts-loader\dist\index.js:68:9)
    at Object.loader (C:\Users\jtuzman\dev\NOUS\front_end\node_modules\ts-loader\dist\index.js:22:12)
 @ ./cypress/integration/ProgressIndicator.spec.js 8:20-58
 @ multi ./cypress/integration/ProgressIndicator.spec.js

./src/types/settings.types.ts
Module build failed (from ./node_modules/ts-loader/index.js):
Error: TypeScript emitted no output for C:\Users\jtuzman\dev\NOUS\front_end\src\types\settings.types.ts.
    at makeSourceMapAndFinish (C:\Users\jtuzman\dev\NOUS\front_end\node_modules\ts-loader\dist\index.js:80:15)
    at successLoader (C:\Users\jtuzman\dev\NOUS\front_end\node_modules\ts-loader\dist\index.js:68:9)
    at Object.loader (C:\Users\jtuzman\dev\NOUS\front_end\node_modules\ts-loader\dist\index.js:22:12)
 @ ./cypress/integration/ProgressIndicator.spec.js 9:23-64
 @ multi ./cypress/integration/ProgressIndicator.spec.js

C:\Users\jtuzman\dev\NOUS\front_end\src\components\App.tsx
[tsl] ERROR in C:\Users\jtuzman\dev\NOUS\front_end\src\components\App.tsx(41,25)
      TS2749: 'W3CWebSocket' refers to a value, but is being used as a type here.

C:\Users\jtuzman\dev\NOUS\front_end\src\components\App.tsx
[tsl] ERROR in C:\Users\jtuzman\dev\NOUS\front_end\src\components\App.tsx(42,26)
      TS2749: 'W3CWebSocket' refers to a value, but is being used as a type here.

C:\Users\jtuzman\dev\NOUS\front_end\src\components\App.tsx
[tsl] ERROR in C:\Users\jtuzman\dev\NOUS\front_end\src\components\App.tsx(64,38)
      TS2749: 'W3CWebSocket' refers to a value, but is being used as a type here.

C:\Users\jtuzman\dev\NOUS\front_end\src\components\App.tsx
[tsl] ERROR in C:\Users\jtuzman\dev\NOUS\front_end\src\components\App.tsx(65,33)
      TS2350: Only a void function can be called with the 'new' keyword.

C:\Users\jtuzman\dev\NOUS\front_end\src\components\App.tsx
[tsl] ERROR in C:\Users\jtuzman\dev\NOUS\front_end\src\components\App.tsx(65,37)
      TS2531: Object is possibly 'null'.

C:\Users\jtuzman\dev\NOUS\front_end\src\components\App.tsx
[tsl] ERROR in C:\Users\jtuzman\dev\NOUS\front_end\src\components\App.tsx(81,37)
      TS2749: 'W3CWebSocket' refers to a value, but is being used as a type here.

C:\Users\jtuzman\dev\NOUS\front_end\src\components\App.tsx
[tsl] ERROR in C:\Users\jtuzman\dev\NOUS\front_end\src\components\App.tsx(82,32)
      TS2350: Only a void function can be called with the 'new' keyword.

C:\Users\jtuzman\dev\NOUS\front_end\src\components\App.tsx
[tsl] ERROR in C:\Users\jtuzman\dev\NOUS\front_end\src\components\App.tsx(82,36)
      TS2531: Object is possibly 'null'.
./src/actions/settings.actions.ts
Module build failed (from ./node_modules/ts-loader/index.js):
Error: TypeScript emitted no output for C:\Users\jtuzman\dev\NOUS\front_end\src\actions\settings.actions.ts.
    at makeSourceMapAndFinish (C:\Users\jtuzman\dev\NOUS\front_end\node_modules\ts-loader\dist\index.js:80:15)
    at successLoader (C:\Users\jtuzman\dev\NOUS\front_end\node_modules\ts-loader\dist\index.js:68:9)
    at Object.loader (C:\Users\jtuzman\dev\NOUS\front_end\node_modules\ts-loader\dist\index.js:22:12)
 @ ./cypress/integration/settings.spec.js 19:25-70
 @ multi ./cypress/integration/settings.spec.js

./src/reducers/settings.reducer.ts
Module build failed (from ./node_modules/ts-loader/index.js):
Error: TypeScript emitted no output for C:\Users\jtuzman\dev\NOUS\front_end\src\reducers\settings.reducer.ts.
    at makeSourceMapAndFinish (C:\Users\jtuzman\dev\NOUS\front_end\node_modules\ts-loader\dist\index.js:80:15)
    at successLoader (C:\Users\jtuzman\dev\NOUS\front_end\node_modules\ts-loader\dist\index.js:68:9)
    at Object.loader (C:\Users\jtuzman\dev\NOUS\front_end\node_modules\ts-loader\dist\index.js:22:12)
 @ ./cypress/integration/settings.spec.js 20:25-71
 @ multi ./cypress/integration/settings.spec.js

赛普拉斯似乎每隔几秒钟就会吐出这些错误。

当我执行调用lodash的isEqual的操作时,还会导致实际的运行时错误:

TypeError: isEqual_1.default is not a function
(anonymous function)
C:/Users/jtuzman/dev/NOUS/front_end/src/actions/settings.actions.js:215
  212 |     return dispatch(exports.reportSettingsChangeSuccess(newState));
  213 | }
  214 | // Compare the received settings with the current settings.
> 215 | if (isEqual_1.default(newState, settings)) {
      | ^  216 |     // If they match, we consider this a "success" response to a settings update request.
  217 |     console.log('SUCCESS: Valid settings update.');
  218 |     return dispatch(exports.reportSettingsChangeSuccess(newState));
View compiled

我相当确定我没有改变任何事情,嗯,什么!我的Webstorm项目中的ts文件在下方显示了一个小箭头,该箭头显示了其已编译的js文件,但是我不记得他们是否一直这样做。我也尝试过设置outDir,但是没有运气。

js文件在我的git状态下均显示为未跟踪,因此可能是一个很大的提示...

发生了什么事?我该如何解决??

0 个答案:

没有答案