我有以下代码:
// 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);
Run Code Online (Sandbox Code Playgroud)
Typescript 不会编译它,但会抱怨:
'React' 被声明,但它的值永远不会被读取。
如果我删除该行,我会得到:
导出的变量“FormInput”具有或正在使用来自外部模块“/node_modules/@types/react/index”的名称“React.ComponentClass”,但无法命名。[ts] 导出的变量“FormInput”具有或正在使用来自外部模块“/node_modules/@types/react/index”的名称“React.StatelessComponent”,但无法命名。
我declaration
在 tsconfig 中设置为 true,这是正确的,因为这是一个包。
小智 6
更新 tsconfig.json
{
"compilerOptions": {
"jsx": "react"
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
14262 次 |
最近记录: |