Closed andrewbranch closed 2 months ago
build
isn't a defined script name in this package. It uses prepare
to build the code, which is the one that npm actually runs when publishing or installing.
I don't typically worry about TypeScript version changes, especially not rc
versions, since I just lock into whatever tshy provides. But in this case, the issue is solved by just dropping the implements Map
from the LRUCache
class. Looks like TS 5.6 rc doesn't like that it says it implements Map, but the forEach callback function has a thisp: typeof this
instead of thisp: Map
. 🤷
Yeah, I should have been more clear: this isn’t just a problem for building, this is a problem that all users of lru-cache would see in e.g. node_modules/lru-cache/dist/esm/index.d.ts
as soon as they upgrade to TypeScript 5.6 because the problem also exists in your published declaration files. The fix you added looks fine for me though.
build isn't a defined script name in this package. It uses prepare to build the code, which is the one that npm actually runs when publishing or installing.
build is aliased to prepare, which runs tshy, but my point is that I thought that tshy would type check. Do you not type check this package from the CLI or during CI?
Tshy does type check, but using its own version of typescript that it depends on.
TypeScript 5.6 (currently in RC) includes some changes to builtin iterator types, which causes several of the iterator-returning methods of LRUCache to be unassignable to its
implements Map<K, V>
. For details, see https://github.com/microsoft/TypeScript/pull/58243. To reproduce:As an aside, I noticed that neither
npm run build
nornpm test
seems to type check currently (or at least tshy isn’t reporting the type errors to the console)—is that intended?