@reframe/typescript

0.3.2 • Public • Published

Reframe + TypeScript = ❤️

@reframe/typescript

Use Reframe with TypeScript.

Usage

Add @reframe/typescript to your reframe.config.js.

module.exports = {
    $plugins: [
        require('@reframe/react-kit'),
        require('@reframe/typescript') // npm install @reframe/typescript
    ],

    // Syntax transformation is done with `@babel/preset-typescript`
    // Options:
    babelPresetTypescript: {
        isTSX: true, // default value
        allExtensions: true, // default value
    },

    // Type checking is done with `fork-ts-checker-webpack-plugin`
    // Options:
    forkTsCheckerWebpackPlugin: {
        // To enable type checking set `enable: true`
        enable: true,
    },
};

Example

// /plugins/typescript/example/pages/landing.config.tsx

import * as React from "react";

interface HelloProps { compiler: string; framework: string; }

const Hello = (props: HelloProps) => <h3>Hello from {props.compiler} and {props.framework}!</h3>;

export default {
    route: '/',
    view: () => <Hello compiler="TypeScript" framework="React" />,
    doNotRenderInBrowser: true,
};
// /plugins/typescript/example/reframe.config.js

module.exports = {
    $plugins: [
        require('@reframe/react-kit'),
        require('@reframe/typescript') // npm install @reframe/typescript
    ],

    // Syntax transformation is done with `@babel/preset-typescript`
    // Options:
    babelPresetTypescript: {
        isTSX: true, // default value
        allExtensions: true, // default value
    },

    // Type checking is done with `fork-ts-checker-webpack-plugin`
    // Options:
    forkTsCheckerWebpackPlugin: {
        // To enable type checking set `enable: true`
        enable: true,
    },
};

Dependents (0)

Package Sidebar

Install

npm i @reframe/typescript

Weekly Downloads

2

Version

0.3.2

License

none

Unpacked Size

7.48 kB

Total Files

5

Last publish

Collaborators

  • brillout