web-ifc-three icon indicating copy to clipboard operation
web-ifc-three copied to clipboard

No type declarations for loadAsync.

Open Hillzkred opened this issue 2 years ago • 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));
  };

Hillzkred avatar Mar 23 '23 17:03 Hillzkred

Hi, how are you instantiating the ifcLoader?

agviegas avatar Mar 25 '23 10:03 agviegas

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

Hillzkred avatar Mar 29 '23 03:03 Hillzkred

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

agviegas avatar Apr 05 '23 09:04 agviegas

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?

Hillzkred avatar Apr 05 '23 19:04 Hillzkred

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

agviegas avatar Apr 14 '23 10:04 agviegas