File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 11import * as revalidateEvents from './constants'
22import { defaultConfig } from './utils/config'
33
4- export type Falsy = undefined | null | false
4+ type Falsy = null | undefined | false
5+ export type TruthyKey = Exclude < Arguments , Falsy >
56
67export type GlobalState = [
78 Record < string , RevalidateCallback [ ] > , // EVENT_REVALIDATORS
@@ -10,7 +11,7 @@ export type GlobalState = [
1011 ScopedMutator , // Mutator
1112 ( key : string , value : any , prev : any ) => void , // Setter
1213 ( key : string , callback : ( current : any , prev : any ) => void ) => ( ) => void , // Subscriber
13- Set < Omit < Arguments , 'null' | 'undefined' > > // Keys
14+ Set < TruthyKey > // Keys
1415]
1516export type FetcherResponse < Data = unknown > = Data | Promise < Data >
1617export type BareFetcher < Data = unknown > = (
Original file line number Diff line number Diff line change @@ -9,11 +9,11 @@ import {
99 MutatorOptions ,
1010 GlobalState ,
1111 State ,
12- Arguments
12+ Arguments ,
13+ TruthyKey
1314} from '../types'
1415
15- type ValidKey = Omit < Arguments , 'null' | 'undefined' >
16- type KeyFilter = ( key ?: ValidKey ) => boolean
16+ type KeyFilter = ( key ?: TruthyKey ) => boolean
1717
1818export async function internalMutate < Data > (
1919 cache : Cache ,
@@ -66,7 +66,7 @@ export async function internalMutate<Data>(
6666 return await mutateByKey ( serializedKey )
6767 }
6868
69- async function mutateByKey ( _k : ValidKey ) : Promise < Data | undefined > {
69+ async function mutateByKey ( _k : TruthyKey ) : Promise < Data | undefined > {
7070 const [ key ] = serialize ( _k )
7171 const [ get , set ] = createCacheHelper <
7272 Data ,
You can’t perform that action at this time.
0 commit comments