diff --git a/lib/factory.ts b/lib/factory.ts index da4511a..3db20fa 100644 --- a/lib/factory.ts +++ b/lib/factory.ts @@ -18,11 +18,11 @@ type NoKey = null | undefined | void | false; type SomeKey = string | number | true; export type KeyInput = | SomeKey - | Array | FetcherStore>; + | ReadonlyArray | FetcherStore>; type Key = string; -type KeyParts = SomeKey[]; -export type KeySelector = Key | Key[] | ((key: Key) => boolean); +type KeyParts = ReadonlyArray; +export type KeySelector = Key | ReadonlyArray | ((key: Key) => boolean); export type Fetcher = (...args: KeyParts) => Promise; @@ -74,8 +74,8 @@ export type FetcherStore = MapStore> & { key?: Key; // Signature accepts anything, but doesn't use it. It's a simplification for // cases where you pass this function directly to promise resolvers, event handlers, etc. - invalidate: (...args: any[]) => void; - revalidate: (...args: any[]) => void; + invalidate: (...args: ReadonlyArray) => void; + revalidate: (...args: ReadonlyArray) => void; mutate: (data?: T) => void; fetch: () => Promise>; };