【发布时间】:2019-11-26 01:50:51
【问题描述】:
我已经退出了 React 项目,我需要将 Typescript 集成到他身上。 我该怎么做?
【问题讨论】:
-
请检查一下,这可能会向您显示潜在客户stackoverflow.com/questions/47508564/…
标签: reactjs typescript
我已经退出了 React 项目,我需要将 Typescript 集成到他身上。 我该怎么做?
【问题讨论】:
标签: reactjs typescript
create-react-app 已经支持 Typescript,如果您在创建应用程序时没有使用标志 --typescript,您可以安装一些新的依赖项并将文件的扩展名更改为 ts 或 tsx让它发挥作用,其余的基本都是在Webpack上配置的。
要安装的依赖项:typescript、@types/react、@types/react-dom、@types/node。
您可以在这里找到更多信息:https://facebook.github.io/create-react-app/docs/adding-typescript
【讨论】: