-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[types] Failed to import new types #273
Comments
Yes, I see, we don't write types manually, they are generated by import CompressionPlugin = require("compression-webpack-plugin");
import type { Rule } from "compression-webpack-plugin/types";
// import { type Rule } from "compression-webpack-plugin/types";
const a: Rule = /test/;
console.log(CompressionPlugin)
console.log(a) |
Just done some more testing. - "types": "types/cjs.d.ts"
+ "types": "types/index.d.ts" With default typescript project config this works fine. import CompressionPlugin, {Rule} from 'compression-webpack-plugin';
const a: Rule = 'a';
const b = new CompressionPlugin();
console.log(a)
console.log(b) Everything else remains the same.
@alexander-akait could you please share a test case that will not work without reexport to P.S. - yarn tsc index.ts
+ yarn tsc |
Yep, we have a problem, we are in cjs, but exports esm types, due babel and traspiling, we should fix it, so I keep it open |
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 importedbecause
Expected Behavior
Using
@types/compression-webpack-plugin@9.0.0
andcompression-webpack-plugin@9.1.0
it's possible to writeHow Do We Reproduce?
yarn init
, use defaultsyarn add typescript
yarn tsc --init
, use defaultsyarn add webpack
yarn add compression-webpack-plugin
index.ts
yarn tsc
Please paste the results of
npx webpack-cli info
here, and mention other relevant informationNot related
The text was updated successfully, but these errors were encountered: