Skip to content

Commit

Permalink
style: fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Nov 20, 2023
1 parent d2a2a5f commit 16897a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/client/src/composables/clientData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import type { InjectionKey } from 'vue'

export const useClientData = <T = unknown, U extends boolean = false>(
key: InjectionKey<T>,
required?: U
required?: U,
): U extends true ? T : T | undefined => {
const result = inject(key)

if (required && !result) {
throw new Error(`Can not found ${key} in clientData()`)
}

return <U extends true ? T : T | undefined>result
return result as U extends true ? T : T | undefined
}
2 changes: 1 addition & 1 deletion packages/client/src/helpers/defineClientData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const clientDataMap = new Map<InjectionKey<unknown>, unknown>()
export const defineClientData = <T = unknown>(
key: InjectionKey<T>,
data: T,
overrideExisting = true
overrideExisting = true,
): void => {
if (overrideExisting || !clientDataMap.has(key)) clientDataMap.set(key, data)
}

0 comments on commit 16897a7

Please sign in to comment.