Skip to content

Commit

Permalink
fix: types regression in v0.14.5 (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin committed Mar 23, 2023
1 parent 03f7c54 commit 32841bb
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 6 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./types": {
"types": "./types/index.d.ts"
},
"./preact": {
"types": "./preact.d.ts"
},
Expand Down
5 changes: 4 additions & 1 deletion preact.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ declare module 'virtual:pwa-register/preact' {
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore ignore when preact/hooks is not installed
import type { StateUpdater } from 'preact/hooks'
import type { RegisterSWOptions } from 'vite-plugin-pwa/types'

export function useRegisterSW(options?: import('./types/register-options').RegisterSWOptions): {
export type { RegisterSWOptions }

export function useRegisterSW(options?: RegisterSWOptions): {
needRefresh: [boolean, StateUpdater<boolean>]
offlineReady: [boolean, StateUpdater<boolean>]
/**
Expand Down
5 changes: 4 additions & 1 deletion react.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ declare module 'virtual:pwa-register/react' {
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore ignore when react is not installed
import type { Dispatch, SetStateAction } from 'react'
import type { RegisterSWOptions } from 'vite-plugin-pwa/types'

export function useRegisterSW(options?: import('./types/register-options').RegisterSWOptions): {
export type { RegisterSWOptions }

export function useRegisterSW(options?: RegisterSWOptions): {
needRefresh: [boolean, Dispatch<SetStateAction<boolean>>]
offlineReady: [boolean, Dispatch<SetStateAction<boolean>>]
/**
Expand Down
5 changes: 4 additions & 1 deletion solid.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ declare module 'virtual:pwa-register/solid' {
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore ignore when solid-js is not installed
import type { Accessor, Setter } from 'solid-js'
import type { RegisterSWOptions } from 'vite-plugin-pwa/types'

export function useRegisterSW(options?: import('./types/register-options').RegisterSWOptions): {
export type { RegisterSWOptions }

export function useRegisterSW(options?: RegisterSWOptions): {
needRefresh: [Accessor<boolean>, Setter<boolean>]
offlineReady: [Accessor<boolean>, Setter<boolean>]
/**
Expand Down
5 changes: 4 additions & 1 deletion svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ declare module 'virtual:pwa-register/svelte' {
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore ignore when svelte is not installed
import type { Writable } from 'svelte/store'
import type { RegisterSWOptions } from 'vite-plugin-pwa/types'

export function useRegisterSW(options?: import('./types/register-options').RegisterSWOptions): {
export type { RegisterSWOptions }

export function useRegisterSW(options?: RegisterSWOptions): {
needRefresh: Writable<boolean>
offlineReady: Writable<boolean>
/**
Expand Down
File renamed without changes.
6 changes: 5 additions & 1 deletion vanillajs.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
declare module 'virtual:pwa-register' {
import type { RegisterSWOptions } from 'vite-plugin-pwa/types'

export type { RegisterSWOptions }

/**
* Registers the service worker returning a callback to reload the current page when an update is found.
*
* @param options the options to register the service worker.
* @return (reloadPage?: boolean) => Promise<void> From version 0.13.2+ `reloadPage` param is not used anymore.
*/
export function registerSW(options?: import('./types/register-options').RegisterSWOptions): (reloadPage?: boolean) => Promise<void>
export function registerSW(options?: RegisterSWOptions): (reloadPage?: boolean) => Promise<void>
}
5 changes: 4 additions & 1 deletion vue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ declare module 'virtual:pwa-register/vue' {
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore ignore when vue is not installed
import type { Ref } from 'vue'
import type { RegisterSWOptions } from 'vite-plugin-pwa/types'

export function useRegisterSW(options?: import('./types/register-options').RegisterSWOptions): {
export type { RegisterSWOptions }

export function useRegisterSW(options?: RegisterSWOptions): {
needRefresh: Ref<boolean>
offlineReady: Ref<boolean>
/**
Expand Down

0 comments on commit 32841bb

Please sign in to comment.