Skip to content
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

TypeScript: { minimized: true } is not allowed by type definition. #663

Closed
babatakao opened this issue Jan 28, 2022 · 5 comments · Fixed by #664 or #666
Closed

TypeScript: { minimized: true } is not allowed by type definition. #663

babatakao opened this issue Jan 28, 2022 · 5 comments · Fixed by #664 or #666

Comments

@babatakao
Copy link

Bug report

README says that info takes { minimized: true } option. However, the type definition only takes string value.

Actual Behavior

This code described in README causes an error Type 'boolean' is not assignable to type 'string'.ts(2322) in TypeScript.

  plugins: [
    new CopyPlugin({
      patterns: [
        "relative/path/to/file.ext",
        {
          from: "**/*",
          // Terser skip this file for minimization
          info: { minimized: true },
        },
      ],
    }),
  ],

Expected Behavior

info: { minimized: true } should be a valid Pattern.

How Do We Reproduce?

Write webpack.config.ts in TypeScript and use CopyWebPackPlugin with info: { minimized: true } option.

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

  System:
    OS: Windows 10 10.0.19044
    CPU: (24) x64 12th Gen Intel(R) Core(TM) i9-12900K
    Memory: 27.13 GB / 63.75 GB
  Binaries:
    Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
    npm: 7.20.6 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 97.0.4692.99
    Edge: Spartan (44.19041.1266.0), Chromium (97.0.1072.76)
    Internet Explorer: 11.0.19041.1202
  Packages:
    copy-webpack-plugin: ^10.2.1 => 10.2.1
    fork-ts-checker-webpack-plugin: ^6.5.0 => 6.5.0
    ts-loader: ^9.2.6 => 9.2.6
    webpack: ^5.67.0 => 5.67.0
    webpack-cli: ^4.9.2 => 4.9.2
    webpack-dev-server: ^4.7.3 => 4.7.
@babatakao
Copy link
Author

Thank you for quickly addressing the issue!

I've just tested with 10.2.3, but the problem is not solved. #664 modifies type CopiedResult, but the type error seems happen on type Info which is not modified. Could you please confirm it again?

@alexander-akait
Copy link
Member

@babatakao
Copy link
Author

ObjectPattern.info references Info https://github.com/webpack-contrib/copy-webpack-plugin/blob/master/types/index.d.ts#L268 which still take [key: string]: string;.

@alexander-akait
Copy link
Member

oh, I see, WIP

@alexander-akait alexander-akait mentioned this issue Jan 31, 2022
6 tasks
@babatakao
Copy link
Author

10.2.4 solves the issue. Thank you again for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants