Skip to content
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

[TypeScript] Add loadAsync typing #21001

Merged
merged 1 commit into from
Jan 6, 2021
Merged

[TypeScript] Add loadAsync typing #21001

merged 1 commit into from
Jan 6, 2021

Conversation

mjurczyk
Copy link
Contributor

@mjurczyk mjurczyk commented Jan 4, 2021

As mentioned by user MikeJF on general discord:

Screenshot 2021-01-04 at 20 27 24

Description

Right now all loadAsync default to Promise<any>. Added typing for loadAsync in Loaders to resemble proper load typing.

@@ -31,4 +31,6 @@ export class ObjectLoader extends Loader {
animations: AnimationClip[]
): T;

loadAsync<ObjectType extends Object3D>( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<ObjectType>;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be like this?

loadAsync<T extends Object3D>( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<T>;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea to be honest. I don't know much about types...
We can merged it as it is and let other people fix it if it's wrong.

@mrdoob
Copy link
Owner

mrdoob commented Jan 5, 2021

This is a chore but... could you update the PR so the loadAsync definition goes in the next line after load?

@mrdoob mrdoob added this to the r125 milestone Jan 5, 2021
@mrdoob mrdoob merged commit a908e48 into mrdoob:dev Jan 6, 2021
@mrdoob
Copy link
Owner

mrdoob commented Jan 6, 2021

Thanks!

@mrdoob
Copy link
Owner

mrdoob commented Jan 6, 2021

fb55cdb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants