Skip to content

Commit

Permalink
fix: harden hooks tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett committed Feb 27, 2023
1 parent 2847837 commit b22c406
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/fiber/src/core/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export interface Loader<T> extends THREE.Loader {
onLoad?: (result: T, ...args: any[]) => void,
onProgress?: (event: ProgressEvent) => void,
onError?: (event: ErrorEvent) => void,
): any
): unknown
}

export type LoaderProto<T> = new (...args: any[]) => Loader<T>
Expand Down
6 changes: 4 additions & 2 deletions packages/fiber/tests/hooks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,14 @@ describe('hooks', () => {

it('can handle useLoader with a loader extension', async () => {
class Loader extends THREE.Loader {
load = (_url: string) => null
load(_url: string, onLoad: (result: null) => void): void {
onLoad(null)
}
}

let proto!: Loader

function Test() {
function Test(): null {
return useLoader(Loader, '', (loader) => (proto = loader))
}
await act(async () => root.render(<Test />))
Expand Down

0 comments on commit b22c406

Please sign in to comment.