Using TypeScript with React Native
TypeScript is a language which extends JavaScript by adding type definitions, much like Flow. -While React Native is built in Flow, it supports both TypeScript and Flow by default.
+Using TypeScript with React Native
TypeScript is a language which extends JavaScript by adding type definitions, much like Flow. While React Native is built in Flow, it supports both TypeScript and Flow by default.
Getting Started with TypeScript
If you're starting a new project, there are a few different ways to get started. You can use the TypeScript template:
react-native init MyTSProject --template typescript
@@ -129,8 +128,7 @@ npm install --save-dev @types/jest @types/react @types/react-native @types/react
Run yarn tsc to type-check your new TypeScript files.
How TypeScript and React Native works
-Out of the box, transforming your files to JavaScript works via the same Babel infrastructure as a non-TypeScript React Native project. We recommend that you use the TypeScript compiler only for type checking. If you have existing TypeScript code being ported to React Native, there are one or two caveats
-to using Babel instead of TypeScript.
+Out of the box, transforming your files to JavaScript works via the same Babel infrastructure as a non-TypeScript React Native project. We recommend that you use the TypeScript compiler only for type checking. If you have existing TypeScript code being ported to React Native, there are one or two caveats to using Babel instead of TypeScript.
What does React Native + TypeScript look like
You can provide an interface for a React Component's Props and State via React.Component<Props, State> which will provide type-checking and editor auto-completing when working with that component in JSX.
// components/Hello.tsx
diff --git a/docs/next/typescript/index.html b/docs/next/typescript/index.html
index 6ed4ea0a4f5..1fff80d0e7f 100644
--- a/docs/next/typescript/index.html
+++ b/docs/next/typescript/index.html
@@ -1,5 +1,5 @@
-Using TypeScript with React Native · React Native Using TypeScript with React Native · React Native
Using TypeScript with React Native
TypeScript is a language which extends JavaScript by adding type definitions, much like Flow. -While React Native is built in Flow, it supports both TypeScript and Flow by default.
+Using TypeScript with React Native
TypeScript is a language which extends JavaScript by adding type definitions, much like Flow. While React Native is built in Flow, it supports both TypeScript and Flow by default.
Getting Started with TypeScript
If you're starting a new project, there are a few different ways to get started. You can use the TypeScript template:
react-native init MyTSProject --template typescript
@@ -129,8 +128,7 @@ npm install --save-dev @types/jest @types/react @types/react-native @types/react
Run yarn tsc to type-check your new TypeScript files.
How TypeScript and React Native works
-Out of the box, transforming your files to JavaScript works via the same Babel infrastructure as a non-TypeScript React Native project. We recommend that you use the TypeScript compiler only for type checking. If you have existing TypeScript code being ported to React Native, there are one or two caveats
-to using Babel instead of TypeScript.
+Out of the box, transforming your files to JavaScript works via the same Babel infrastructure as a non-TypeScript React Native project. We recommend that you use the TypeScript compiler only for type checking. If you have existing TypeScript code being ported to React Native, there are one or two caveats to using Babel instead of TypeScript.
What does React Native + TypeScript look like
You can provide an interface for a React Component's Props and State via React.Component<Props, State> which will provide type-checking and editor auto-completing when working with that component in JSX.
// components/Hello.tsx