-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
ObjectLoader: Fix TS definition of .load() #15958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This seems to be a misunderstanding. |
|
It looks like you are working with an instance of |
|
Lines 21 to 101 in 09e1fde
Lines 20 to 33 in 09e1fde
|
|
Okay, I see what you mean. But still, the ObjectLoader packed in the module, returns an object with the Typescript Type |
Then there is a problem in three.js/src/loaders/ObjectLoader.d.ts Line 16 in 09e1fde
|
|
I see what is going on. Thanks for clearing it up! A solution for this could be a |
|
Similar to this code? three.js/src/loaders/ObjectLoader.d.ts Line 22 in 09e1fde
|
Wouldn't this work? onLoad?: (object: Scene | Mesh | Line | LineSegments | Points) => void, |
|
As an alternative, I think it would also work to define a generic type derived from Not sure which approach is better 🤔 |
@jeffreylanters you choose 🙂 |
Like I said before, I think a generic approach would be the best way to go. I think this looks is perfect. Thanks for thinking with me! |
Turned the onLoad parameter of the ObjectLoader.load function a generic type of Object3D so users can define which kind of object they are loaded so it stays typed.
|
I've updated the PR. |
|
Thanks! |




The Object3D typings we're missing the material.