babel-plugin-strip-typehint-imports

1.0.6 • Public • Published

babel-plugin-strip-typehint-imports

Say you want to import something, but only use it for typehinting. This is the plugin for you!

import { MyType } from 'file.d.ts'; // typehints-only

/** @type {MyType} */
const something = {
    // ...
};

Turns into

/** @type {MyType} */
const something = {
    // ...
};

install

With npm

npm install --save-dev babel-plugin-strip-typehint-imports

With yarn

npm install --save-dev babel-plugin-strip-typehint-imports

And add the plugin to your .babelrc file

{
    "plugins": [
        "strip-typehint-imports"
    ]
}

You can also change which text is used to strip the imports.

{
    "plugins": [
        ["strip-typehint-imports", {
            "text": "remove me"
        }]
    ]
}

will remove the following import statement:

import {a} from 'b'; // remove me

Readme

Keywords

none

Package Sidebar

Install

npm i babel-plugin-strip-typehint-imports

Weekly Downloads

26

Version

1.0.6

License

MIT

Unpacked Size

5.98 kB

Total Files

5

Last publish

Collaborators

  • bary12