Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit fbbdd5f

Browse files
author
Je
committed
refactor: update hook types
1 parent 16cce8b commit fbbdd5f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

hooks.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
import { DependencyList, useContext, useEffect, useState } from 'https://esm.sh/react'
1+
import { useContext, useEffect, useState } from 'https://esm.sh/react'
22
import { RouterContext } from './context.ts'
33
import { AsyncUseDenoError } from './error.ts'
44
import events from './events.ts'
5+
import type { RouterURL } from './types.ts'
56

6-
export function useRouter() {
7+
export function useRouter(): RouterURL {
78
return useContext(RouterContext)
89
}
910

10-
export function useDeno<T = any>(callback: () => (T | Promise<T>), browser?: boolean, deps?: DependencyList) {
11+
export function useDeno<T = any>(callback: () => (T | Promise<T>), browser?: boolean, deps?: ReadonlyArray<any>): T {
1112
const id = arguments[3] // generated by compiler
1213
const { pathname, query } = useRouter()
13-
const [data, setDate] = useState<T>(() => {
14+
const [data, setDate] = useState(() => {
1415
const global = window as any
1516
const { _useDenoAsyncData: asyncData } = global
1617
const useDenoUrl = `useDeno://${pathname}?${query.toString()}`

0 commit comments

Comments
 (0)