microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
98.27k stars 12.2k forks source link

5.5.0 regression - importHelpers do not work with moduleResolution: bundler #58325

Closed Knagis closed 1 week ago

Knagis commented 2 weeks ago

🔎 Search Terms

importHelpers This syntax requires an imported helper but module 'tslib' cannot be found. TS2354

🕗 Version & Regression Information

fails on 5.5.0-beta

reproduces on 5.5.0-dev.20240425 can't be reproduced on playground as it seems to ignore importHelpers

⏯ Playground Link

https://github.com/Knagis/importHelpers-5.5.0

💻 Code

tsconfig.json:

{
    "compilerOptions": {
        "importHelpers": true,
        "target": "es2017",
        "module": "ESNext",
        "moduleResolution": "Bundler"
    },
    "include": [
        "./src/**/*",
    ],
}

src/index.ts

export function foo(args: any) {
    const { bar, ...extraArgs } = args;
    return extraArgs;
}

🙁 Actual behavior

node_modules\.bin\tsc -b
src/index.ts:2:21 - error TS2354: This syntax requires an imported helper but module 'tslib' cannot be found.

2     const { bar, ...extraArgs } = args;
                      ~~~~~~~~~

Found 1 error.

🙂 Expected behavior

Code compiles without errors.

Additional information about the issue

No response

RyanCavanaugh commented 2 weeks ago

Bisects to #57896

andrewbranch commented 1 week ago

Duplicate of https://github.com/microsoft/TypeScript/issues/57688