microsoft / tslib

Runtime library for TypeScript helpers.
BSD Zero Clause License
1.25k stars 126 forks source link

[2.5.1][Regression] imported helper named '__decorate' does not exist in 'tslib' #203

Closed AviVahl closed 1 year ago

AviVahl commented 1 year ago

See failures at: https://github.com/AviVahl/native-esm-lit/pull/33 2.5.0 works. 2.5.1 broken.

Can be reproduced locally.

Project uses:

"module": "node16",
"moduleResolution": "node16",
"experimentalDecorators": true

Verified it's not a duplicate version or anything like that.

jakebailey commented 1 year ago

Package diff: https://diff.intrinsic.com/tslib/2.5.0/2.5.1

I can only assume that things broke due to #179, #200, and/or #201?

@andrewbranch @weswigham

andrewbranch commented 1 year ago

I wonder if this code path in TS itself isn’t doing the work to resolve the export * re-export, assuming it can find the named export it wants directly on symbol.exports

AviVahl commented 1 year ago

Thanks for the quick fix. :heart:

e6c31d commented 1 year ago

@andrewbranch,

I'm still seeing this issue with tslib 2.5.2. See this project to reproduce: https://github.com/e6c31d/tslib-issue

Should I open a new issue or can this issue be re-opened?

andrewbranch commented 1 year ago

Well, this is a bummer. It’s a TypeScript bug that’s going to prevent re-exports from working in tslib at all. Specifically, __classPrivateFieldGet, __classPrivateFieldSet, and __spreadArray are checked for arity, which will fail on re-exports since the necessary alias resolution call is missing. We’ll have to get a TS patch out ASAP (again), but I don’t know if this one is reasonably fixable from the tslib side.

andrewbranch commented 1 year ago

This is fixed in TypeScript 5.1 (just published), and I’m working to get it into a 5.0 patch as well. If you’re affected by this and stuck on an older version of TypeScript, you’ll need to roll back to tslib@2.5.0.