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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.626latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.626
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.01

Package Sidebar

Install

npm i babel-plugin-strip-typehint-imports

Weekly Downloads

27

Version

1.0.6

License

MIT

Unpacked Size

5.98 kB

Total Files

5

Last publish

Collaborators

  • bary12