Skip to content

Commit

Permalink
fix(useLoader): loosen Loader onError signature (#3011)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett committed Sep 17, 2023
1 parent 60b7e09 commit 356ef8f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/fiber/src/core/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface Loader<T> extends THREE.Loader {
url: string,
onLoad?: (result: T) => void,
onProgress?: (event: ProgressEvent) => void,
onError?: (event: ErrorEvent) => void,
onError?: (event: unknown) => void,
): unknown
loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<T>
}
Expand Down Expand Up @@ -101,12 +101,12 @@ function loadingFn<L extends LoaderProto<any>>(
new Promise((res, reject) =>
loader.load(
input,
(data: any) => {
(data) => {
if (data.scene) Object.assign(data, buildGraph(data.scene))
res(data)
},
onProgress,
(error) => reject(new Error(`Could not load ${input}: ${error.message}`)),
(error) => reject(new Error(`Could not load ${input}: ${(error as ErrorEvent)?.message}`)),
),
),
),
Expand Down

0 comments on commit 356ef8f

Please sign in to comment.