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

No type declarations for loadAsync. #159

Open
Hillzkred opened this issue Mar 23, 2023 · 5 comments
Open

No type declarations for loadAsync. #159

Hillzkred opened this issue Mar 23, 2023 · 5 comments

Comments

@Hillzkred
Copy link

Using the loadAsync method throws an error in the IDE.
image
image

  const handleUpload = async (event: ChangeEvent<HTMLInputElement>) => {
    const IfcFileFromEvent = event.target.files as FileList;
    const url = URL.createObjectURL(IfcFileFromEvent[0]);
    await ifcLoader
      .loadAsync(url)
      .then((model: SetStateAction<IFCModel | null>) => scene.add(model));
  };
@agviegas
Copy link
Collaborator

Hi, how are you instantiating the ifcLoader?

@Hillzkred
Copy link
Author

Hi, how are you instantiating the ifcLoader?

Hello, I'm instantiating it like this:

   const ifcLoader = new IFCLoader();

This code works, I'm just getting some type errors.

 const ifcLoader = new IFCLoader();

 const handleUpload = async (event: ChangeEvent<HTMLInputElement>) => {
   const IfcFileFromEvent = event.target.files as FileList;
   const url = URL.createObjectURL(IfcFileFromEvent[0]);
   await ifcLoader
     .loadAsync(url)
     .then((model: SetStateAction<IFCModel | null>) => scene.add(model));
 };

@agviegas
Copy link
Collaborator

agviegas commented Apr 5, 2023

Hmm, looks strange, but it works for me 🤔 Maybe you need to import the types of Three.js?

@Hillzkred
Copy link
Author

Hmm, looks strange, but it works for me 🤔 Maybe you need to import the types of Three.js?

image
loadAsync isn't listed. Could this be a Three.js type issue?

@agviegas
Copy link
Collaborator

Does your version of three match the version of three that the library depends on?

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

No branches or pull requests

2 participants