Skip to content

Commit 2c6e5a7

Browse files
committed
rename type and export it
1 parent 40820c4 commit 2c6e5a7

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export {
2121
BareFetcher,
2222
Fetcher,
2323
MutatorCallback,
24+
MutatorOptions,
2425
Middleware,
2526
Arguments
2627
} from './types'

src/types.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export type MutatorCallback<Data = any> = (
142142
currentValue?: Data
143143
) => Promise<undefined | Data> | undefined | Data
144144

145-
export type MutatorOption = {
145+
export type MutatorOptions = {
146146
revalidate?: boolean
147147
populateCache?: boolean
148148
}
@@ -167,27 +167,27 @@ export type Mutator<Data = any> = (
167167
cache: Cache,
168168
key: Key,
169169
data?: Data | Promise<Data> | MutatorCallback<Data>,
170-
opts?: boolean | MutatorOption
170+
opts?: boolean | MutatorOptions
171171
) => Promise<Data | undefined>
172172

173173
export interface ScopedMutator<Data = any> {
174174
/** This is used for bound mutator */
175175
(
176176
key: Key,
177177
data?: Data | Promise<Data> | MutatorCallback<Data>,
178-
opts?: boolean | MutatorOption
178+
opts?: boolean | MutatorOptions
179179
): Promise<Data | undefined>
180180
/** This is used for global mutator */
181181
<T = any>(
182182
key: Key,
183183
data?: T | Promise<T> | MutatorCallback<T>,
184-
opts?: boolean | MutatorOption
184+
opts?: boolean | MutatorOptions
185185
): Promise<T | undefined>
186186
}
187187

188188
export type KeyedMutator<Data> = (
189189
data?: Data | Promise<Data> | MutatorCallback<Data>,
190-
opts?: boolean | MutatorOption
190+
opts?: boolean | MutatorOptions
191191
) => Promise<Data | undefined>
192192

193193
// Public types

src/utils/mutate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import { SWRGlobalState, GlobalState } from './global-state'
44
import { broadcastState } from './broadcast-state'
55
import { getTimestamp } from './timestamp'
66

7-
import { Key, Cache, MutatorCallback, MutatorOption } from '../types'
7+
import { Key, Cache, MutatorCallback, MutatorOptions } from '../types'
88

99
export const internalMutate = async <Data>(
1010
...args: [
1111
Cache,
1212
Key,
1313
undefined | Data | Promise<Data | undefined> | MutatorCallback<Data>,
14-
undefined | boolean | MutatorOption
14+
undefined | boolean | MutatorOptions
1515
]
1616
) => {
1717
const [cache, _key, _data, _opts] = args

0 commit comments

Comments
 (0)