3
1

More than 1 year has passed since last update.

【Typescript】tscコンパイル時のエラー

Posted at

TypeScriptの勉強をしようと、
nodeのバージョンが12だったので、グローバルで16に上げたんですが、
tscコンパイラ時に下記のエラーが出てしまいました。

../../../node_modules/@types/react/index.d.ts:239:10 - error TS2456: Type alias 'ReactFragment' circularly references itself.

239     type ReactFragment = {} | Iterable<ReactNode>;
             ~~~~~~~~~~~~~

../../../node_modules/@types/react/index.d.ts:239:31 - error TS2304: Cannot find name 'Iterable'.

239     type ReactFragment = {} | Iterable<ReactNode>;
                                  ~~~~~~~~

../../../node_modules/@types/react/index.d.ts:240:10 - error TS2456: Type alias 'ReactNode' circularly references itself.

240     type ReactNode = ReactChild | ReactFragment | ReactPortal | boolean | null | undefined;
             ~~~~~~~~~

../../../node_modules/@types/react/index.d.ts:421:23 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.

421         interactions: Set<SchedulerInteraction>,
                          ~~~

../../../node_modules/@types/scheduler/tracing.d.ts:64:35 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.

64   onWorkScheduled: (interactions: Set<Interaction>, threadID: number) => void;
                                     ~~~

../../../node_modules/@types/scheduler/tracing.d.ts:70:34 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.

70   onWorkCanceled: (interactions: Set<Interaction>, threadID: number) => void;
                                    ~~~

../../../node_modules/@types/scheduler/tracing.d.ts:80:33 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.

80   onWorkStarted: (interactions: Set<Interaction>, threadID: number) => void;
                                   ~~~

../../../node_modules/@types/scheduler/tracing.d.ts:86:33 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.

86   onWorkStopped: (interactions: Set<Interaction>, threadID: number) => void;
                                   ~~~

../../../node_modules/@types/scheduler/tracing.d.ts:90:12 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.

90   current: Set<Interaction>;
              ~~~

../../../node_modules/@types/scheduler/tracing.d.ts:102:40 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.

102 export function unstable_getCurrent(): Set<Interaction> | null;
                                           ~~~


Found 10 errors.

しかし、運良く下記のStackOverflowに改善記事がありました。

How to fix cannot find name Set

npm install @types/node --save-dev

これで無事、コンパイルされました。

@types パッケージ (DefinitelyTyped)

3
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1