【发布时间】:2023-03-15 09:33:01
【问题描述】:
我有以下代码:
// 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 不会编译它但会报错:
'React' 已声明,但它的值从未被读取。
如果我删除我得到的行:
导出的变量“FormInput”已经或正在使用来自外部模块“/node_modules/@types/react/index”的名称“React.ComponentClass”,但无法命名。 [ts] 导出的变量“FormInput”已经或正在使用来自外部模块“/node_modules/@types/react/index”的名称“React.StatelessComponent”,但无法命名。
我在 tsconfig 中将 declaration 设置为 true,这是正确的,因为这是一个包。
【问题讨论】:
标签: typescript