Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'React' is declared but its value is never read

Tags:

typescript

I have the following code:

// tslint:disable
import * as React from 'react';
import { Input, InputProps } from '../atoms/Input/Input';
import { FormControl } from '../hoc/FormControl/FormControl';

export const FormInput = FormControl<InputProps>(Input);

Typescript will not compile it but complains:

'React' is declared but its value is never read.

If I remove the line I get:

Exported variable 'FormInput' has or is using name 'React.ComponentClass' from external module "/node_modules/@types/react/index" but cannot be named. [ts] Exported variable 'FormInput' has or is using name 'React.StatelessComponent' from external module "/node_modules/@types/react/index" but cannot be named.

I have declaration set to true in tsconfig which is correct as this is a package.

like image 980
dagda1 Avatar asked Aug 10 '18 14:08

dagda1


1 Answers

update tsconfig.json

{
  "compilerOptions": {
     "jsx": "react"
  }
}
like image 84
Kairi Selena Avatar answered Oct 23 '22 13:10

Kairi Selena