Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

A babel preset for React Native, using TypeScript instead of Flow

Notifications You must be signed in to change notification settings

LinusU/babel-preset-react-native-typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Babel Preset: React Native TypeScript

A babel preset for React Native, using TypeScript instead of Flow.

This module works as a drop in replacement for babel-preset-react-native, but switches out the transform-flow-strip-types plugin for transform-typescript.

Note that the TypeScript transform plugin is new in Babel 7, and thus this preset only works with Babel 7 and newer, which is included with React Native 0.56 and newer.

Installation

npm install --save-dev babel-preset-react-native-typescript

Usage

In your .babelrc:

{
  "presets": ["react-native-typescript"]
}

In order to use the .ts and .tsx extension, you also need to configure React Native to look for those files. In your rn-cli.config.js:

module.exports = {
  getSourceExts () {
    return ['ts', 'tsx']
  },
}

About

A babel preset for React Native, using TypeScript instead of Flow

Resources

Stars

Watchers

Forks

Packages

No packages published