Skip to content

[types] Failed to import new types #273

@vitoyucepi

Description

@vitoyucepi

Bug report

Since 0acff90 compression-webpack-plugin provides it's own types and @types/compression-webpack-plugin has marked as stub.
But it's unable to simply migrate from one to another because types can't be imported in the same way.

Actual Behavior

With compression-webpack-plugin@9.1.1 types can't be imported

import {Rule} from 'compression-webpack-plugin'

because

index.ts:1:9 - error TS2305: Module '"compression-webpack-plugin"' has no exported member 'Rule'.

Expected Behavior

Using @types/compression-webpack-plugin@9.0.0 and compression-webpack-plugin@9.1.0 it's possible to write

import {Rule} from 'compression-webpack-plugin'

How Do We Reproduce?

  1. yarn init, use defaults
  2. yarn add typescript
  3. yarn tsc --init, use defaults
  4. yarn add webpack
  5. yarn add compression-webpack-plugin
  6. Create index.ts
    import {Rule} from 'compression-webpack-plugin';
    
    const a: Rule = 'a';
    console.log(a)
  7. yarn tsc

Please paste the results of npx webpack-cli info here, and mention other relevant information

Not related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions