babel-preset-react-native-typescript

1.0.0-rc.1 • Public • Published

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']
  },
}

Package Sidebar

Install

npm i babel-preset-react-native-typescript

Weekly Downloads

2

Version

1.0.0-rc.1

License

MIT

Unpacked Size

2.05 kB

Total Files

3

Last publish

Collaborators

  • linusu