Not a Package Manager

    @martinadamec/rollup-plugin-dts
    TypeScript icon, indicating that this package has built-in type declarations

    1.3.1 • Public • Published

    rollup-plugin-dts

    Build Status Coverage Status

    This is a plugin that lets you roll-up your .d.ts definition files.

    Usage

    Install the package from npm:

    $ npm install --save-dev rollup-plugin-dts
    

    Add it to your rollup.config.js:

    import dts from "rollup-plugin-dts";
    
    const config = [
      // …
      {
        input: "./my-input/index.d.ts",
        output: [{ file: "dist/my-library.d.ts", format: "es" }],
        plugins: [dts()],
      },
    ];
    
    export default config;

    And then instruct typescript where to find your definitions inside your package.json:

      "types": "dist/my-library.d.ts",

    NOTE that the plugin will automatically mark any external library (@types for example) as external, so those will be excluded from bundling.

    Why?

    Well, ideally TypeScript should just do all this itself, and it even has a proposal to do that. But there hasn’t been any progress in ~3 years.

    Some projects, like rollup itself go the route of completely separating their public interfaces in a separate file.

    Alternatives

    See some discussions about some of these projects and their tradeoffs.

    How does it work

    Compatibility Notice

    This plugin tracks the latest versions of both rollup and typescript. I do not guarantee backwards compatibility to older versions of these peer dependencies, so breakage may occur. This may not strictly adhere to the definition of semver, but meh…

    License

    The code is licensed under the copyleft LGPL-3.0. I have no intention to license this under any non-copyleft license.

    Install

    npm i @martinadamec/rollup-plugin-dts

    DownloadsWeekly Downloads

    0

    Version

    1.3.1

    License

    LGPL-3.0

    Unpacked Size

    103 kB

    Total Files

    6

    Last publish

    Collaborators

    • martin20a