We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cd
yarn add @types/react @types/react-native yarn add --dev react-native-typescript-transformer typescript or npm install --save @types/react @types/react-native npm install --save-dev react-native-typescript-transformer typescript
tsconfig.json
{ "compilerOptions": { "module": "es2015", "target": "es2015", "jsx": "react-native", "moduleResolution": "node", "allowSyntheticDefaultImports": true } }
rn-cli.config.js
module.exports = { getTransformModulePath() { return require.resolve('react-native-typescript-transformer'); }, getSourceExts() { return ['ts', 'tsx']; }, };
tsx
import * as React from 'react'; import { Component } from 'react';
The text was updated successfully, but these errors were encountered:
可以使用 --template react-native init MyApp --template typescript
Sorry, something went wrong.
@syanbo 新版功能咩,好久没关注
No branches or pull requests
cd
到根目录;tsconfig.json
文件:rn-cli.config.js
文件:tsx
为后缀命名,修改 React 的引用方式:The text was updated successfully, but these errors were encountered: