React typescript import syntax issues with vscode

Kimmo Hintikka

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.

basarat

you need to get typings for react and react-dom.

QUICK:

npm install --save-dev @types/react @types/react-dom.

Similar for react-dom.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

React/Typescript /VScode - an import path cannot end with a '.tsx' extension

Typescript, React and Recompose issues

Having issues with typescript in react

export import <name> syntax in TypeScript?

Typescript import syntax with Angular / Rxjs

Import hooks into React Typescript

VsCode Syntax Highlighting not working for javascript/typescript

VSCode intellisense for Typescript Vue (Auto import at @Component)

Difference between import React and import { Component } syntax

Short TypeScript import statement syntax not working in Angular

Javascript/Typescript - Different syntax to import class

React/Typescript - Confused about syntax

How to make VSCode play nice with React syntax?

React with TypeScript - how to import methods

eslint import/order react typescript

Issues setting up a router in React typescript

React-beautiful-dnd typescript compiler issues

React Hook Form - Typescript issues and error handling?

VSCode TypeScript Auto Import Suggestions - Symbol Resolution Logic

Automatic import refactoring when moving Typescript files in VSCode?

VSCode Typescript why suggest "Auto import from 'node:path'"

How to convert typescript npm module import syntax to ECMA2015 module import syntax

React + TypeScript Syntax: Dynamically change container component

Syntax for Typescript prop types for React component?

What does this syntax mean in React Native and TypeScript?

concise and readable syntax for props in a react component in typescript

React Typescript Functional Component Syntax Error

how to change syntax Typescript to javascript React native

how to use node module with es6 import syntax in typescript