ThatOpen/web-ifc-three

No type declarations for loadAsync.

Hillzkred opened this issue · 5 comments

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));
  };

Hi, how are you instantiating the ifcLoader?

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));
 };

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

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?

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