使用终端中的tsc编译类型脚本时的Typescript错误

时间:2017-04-21 10:39:56

标签: node.js typescript compiler-errors

gowd95@gowd:~/Desktop/myapp/src/app$ tsc greeter.ts  
 ../../node_modules/@types/core-js/index.d.ts(39,27): error TS2304: Cannot find name 'IterableIterator'.  
../../node_modules/@types/core-js/index.d.ts(47,36): error TS2304: Cannot find name 'Iterable'.  
../../node_modules/@types/core-js/index.d.ts(226,38): error TS2304: Cannot find name 'IterableIterator'.  
../../node_modules/@types/core-js/index.d.ts(231,35): error TS2304: Cannot find name 'IterableIterator'.  
../../node_modules/@types/core-js/index.d.ts(236,37): error TS2304: Cannot find name 'IterableIterator'.  
../../node_modules/@types/core-js/index.d.ts(349,33): error TS2304: Cannot find name 'IterableIterator'.  
../../node_modules/@types/core-js/index.d.ts(350,31): error TS2304: Cannot find name 'IterableIterator'.  
../../node_modules/@types/core-js/index.d.ts(351,34): error TS2304: Cannot find name 'IterableIterator'.  
../../node_modules/@types/core-js/index.d.ts(352,34): error TS2304: Cannot find name 'PropertyKey'.  
../../node_modules/@types/core-js/index.d.ts(353,34): error TS2304: Cannot find name 'PropertyKey'.  
../../node_modules/@types/core-js/index.d.ts(354,34): error TS2304: Cannot find name 'PropertyKey'.  
../../node_modules/@types/core-js/index.d.ts(355,61): error TS2304: Cannot find name 'PropertyKey'.  
../../node_modules/@types/core-js/index.d.ts(356,60): error TS2304: Cannot find name 'PropertyKey'.  
../../node_modules/@types/core-js/index.d.ts(357,65): error TS2304: Cannot find name 'PropertyKey'.  
../../node_modules/@types/core-js/index.d.ts(357,97): error TS2304: Cannot find name 'PropertyKey'.  
../../node_modules/@types/core-js/index.d.ts(358,60): error TS2304: Cannot find name 'PropertyKey'.  
../../node_modules/@types/core-js/index.d.ts(359,58): error TS2304: Cannot find name 'PropertyKey'.  
../../node_modules/@types/core-js/index.d.ts(360,59): error TS2304: Cannot find name 'PropertyKey'.  
../../node_modules/@types/core-js/index.d.ts(361,58): error TS2304: Cannot find name 'PropertyKey'.  
../../node_modules/@types/core-js/index.d.ts(362,61): error TS2304: Cannot find name 'PropertyKey'.  
../../node_modules/@types/core-js/index.d.ts(362,117): error TS2304: Cannot find name 'PropertyKey'  .  
../../node_modules/@types/core-js/index.d.ts(363,42): error TS2304: Cannot find name 'PropertyKey'.    
../../node_modules/@types/core-js/index.d.ts(365,81): error TS2304: Cannot find name 'PropertyKey'.     
../../node_modules/@types/core-js/index.d.ts(366,78): error TS2304: Cannot find name 'PropertyKey'.    
../../node_modules/@types/core-js/index.d.ts(367,76): error TS2304: Cannot find name 'PropertyKey'.    
../../node_modules/@types/core-js/index.d.ts(368,73): error TS2304: Cannot find name 'PropertyKey'.  
../../node_modules/@types/core-js/index.d.ts(431,6): error TS2304: Cannot find name 'Symbol'.
../../node_modules/@types/core-js/index.d.ts(431,26): error TS2304: Cannot find name 'IterableIterator'.
../../node_modules/@types/core-js/index.d.ts(464,59): error TS2304: Cannot find name 'PropertyKey'.
../../node_modules/@types/core-js/index.d.ts(465,59): error TS2304: Cannot find name 'PropertyKey'.
../../node_modules/@types/core-js/index.d.ts(466,42): error TS2304: Cannot find name 'IterableIterator'.
../../node_modules/@types/core-js/index.d.ts(467,48): error TS2304: Cannot find name 'PropertyKey'.
../../node_modules/@types/core-js/index.d.ts(468,69): error TS2304: Cannot find name 'PropertyKey'.
../../node_modules/@types/core-js/index.d.ts(472,40): error TS2304: Cannot find name 'PropertyKey'.
../../node_modules/@types/core-js/index.d.ts(474,48): error TS2304: Cannot find name 'PropertyKey'.
../../node_modules/@types/core-js/index.d.ts(494,55): error TS2304: Cannot find name 'PropertyKey'.
../../node_modules/@types/core-js/index.d.ts(495,45): error TS2304: Cannot find name 'PropertyKey'.
../../node_modules/@types/core-js/index.d.ts(511,46): error TS2304: Cannot find name 'Iterable'.
../../node_modules/@types/core-js/index.d.ts(512,43): error TS2304: Cannot find name 'Iterable'.
../../node_modules/@types/core-js/index.d.ts(535,42): error TS2304: Cannot find name 'IterableIterator'.
../../node_modules/@types/core-js/index.d.ts(536,39): error TS2304: Cannot find name 'IterableIterator'.  
../../node_modules/@types/core-js/index.d.ts(537,41): error TS2304: Cannot find name 'IterableIterator'.  
../../node_modules/@types/core-js/index.d.ts(623,16): error TS2304: Cannot find name 'MapConstructor'.  
../../node_modules/@types/core-js/index.d.ts(624,16): error TS2304: Cannot find name 'SetConstructor'.  
../../node_modules/@types/core-js/index.d.ts(625,20): error TS2304: Cannot find name 'WeakMapConstructor'.  
../../node_modules/@types/core-js/index.d.ts(626,20): error TS2304: Cannot find name 'WeakSetConstructor'.  
../../node_modules/@types/core-js/index.d.ts(627,20): error TS2304: Cannot find name 'PromiseConstructor'.  
../../node_modules/@types/core-js/index.d.ts(642,32): error TS2304: Cannot find name 'Iterable'.  
../../node_modules/@types/core-js/index.d.ts(646,39): error TS2304: Cannot find name 'Iterable'.  
../../node_modules/@types/core-js/index.d.ts(646,53): error TS2304: Cannot find name 'Iterator'.  
../../node_modules/@types/core-js/index.d.ts(1280,36): error TS2339: Property 'for' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(1284,43): error TS2339: Property 'hasInstance' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(1288,50): error TS2339: Property 'isConcatSpreadable' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(1292,40): error TS2339: Property 'iterator' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(1296,38): error TS2339: Property 'keyFor' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(1300,37): error TS2339: Property 'match' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(1304,39): error TS2339: Property 'replace' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(1308,38): error TS2339: Property 'search' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(1312,39): error TS2339: Property 'species' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(1316,37): error TS2339: Property 'split' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(1320,43): error TS2339: Property 'toPrimitive' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(1324,43): error TS2339: Property 'toStringTag' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(1328,43): error TS2339: Property 'unscopables' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(2059,36): error TS2339: Property 'for' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(2063,43): error TS2339: Property 'hasInstance' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(2067,50): error TS2339: Property 'isConcatSpreadable' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(2071,40): error TS2339: Property 'iterator' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(2075,38): error TS2339: Property 'keyFor' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(2079,37): error TS2339: Property 'match' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(2083,39): error TS2339: Property 'replace' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(2087,38): error TS2339: Property 'search' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(2091,39): error TS2339: Property 'species' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(2095,37): error TS2339: Property 'split' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(2099,43): error TS2339: Property 'toPrimitive' does not exist on type 'SymbolConstructor'.  
../../node_modules/@types/core-js/index.d.ts(2103,43): error TS2339: Property 'toStringTag' does not exist on type 'SymbolConstructor'.   
../../node_modules/@types/core-js/index.d.ts(2107,43): error TS2339: Property 'unscopables' does not exist on type 'SymbolConstructor'.

1 个答案:

答案 0 :(得分:4)

我个人解决这些错误的方法

  • 不要将@types用于core-js。仅将core-js用作垫片
  • 请改用lib es6选项。

更多