TypeScript + Babel 7 基于Babel 7新功能构建的示例TypeScript项目。 包括React 16,Jest和Enzyme(用于测试)。 由于不再需要使用TypeScript编译器来编译源代码,因此您可以保留现有的Babel管道,而是依靠基于编辑器的类型检查或tsc 。 安装 git clone https://github.com/damassi/babel-7-typescript-example && cd babel-7-typescript-example yarn install yarn start yarn test:watch yarn typecheck 有关使用Webpack的更完整的示例,请参见此-感谢@flobacher。 如果使用VSCode,请确保安装推荐的扩展。 例 // App.tsx import React , { Component } from ' react ' interface Props { name : string } export const App extends Component < Pr
1