lukemorales / query-key-factory

A library for creating typesafe standardized query keys, useful for cache management in @tanstack/query
https://www.npmjs.com/package/@lukemorales/query-key-factory
MIT License
1.21k stars 32 forks source link

Overwriting global isArray definition causes issues #43

Closed JanStevens closed 1 year ago

JanStevens commented 1 year ago

Hi,

I noticed that the following code causes issues in places where I already use Array.isArray

https://github.com/lukemorales/query-key-factory/blob/4d56c4a341196e7d02ed44fbd325493298ad2f70/src/internals/types.ts#L1-L5

Example, when using MUI v5, its typical to pass around the sx prop and spread it (docs: https://mui.com/system/getting-started/the-sx-prop/#passing-the-sx-prop)

Example:

Screenshot 2023-01-09 at 11 38 02

When I comment out the redeclaration of Array.isArray I don't have the above errors anymore.

lukemorales commented 1 year ago

Thanks for bringing that up @JanStevens, I'll prepare a new release that fixes it