Reputation: 15530
I just started testing with react typescript + Meteor and I cannot figure out how to setup VSCode properly.
TSX and TS file react autocomplete and syntax highlighting works fine, but every module import trickers vscode critical errors.
[ts] Cannot find module 'react'
[ts] Cannot find module 'react-dom'
My import statement below.
import * as React from "react";
import { render } from "react-dom";
Components load fine so imports actually are working, but I get syntax highlighting issues for every import and I want to fix this.
I do not have any tsconfig.json files or typings folder.
I am using https://github.com/barbatus/typescript to automatically transpile typescript files for meteor build. Background this has both typings files tsconfig.json.
Upvotes: 2
Views: 2442
Reputation: 276383
you need to get typings for react
and react-dom
.
npm install --save-dev @types/react @types/react-dom
.
Similar for react-dom.
Upvotes: 4
Reputation: 3907
instead of typings use npm directly.
npm install --save-dev @types/react @types/react-dom
Upvotes: 2