after updating to the latest Babylonjs (6.9.0) and Typescript (5.1.3) I’m getting this typescript error:
ERROR(TypeScript) Property ‘loadFile’ in type ‘GLTFFileLoader’ is not assignable to the same property in base type ‘ISceneLoaderPluginAsync’.
Type ‘(scene: Scene, fileOrUrl: string | File, onSuccess: (data: any, responseURL?: string) => void, onProgress?: (ev: ISceneLoaderProgressEvent) => void, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: LoadFileError) => void) => IFileRequest’ is not assignable to type ‘(scene: Scene, fileOrUrl: string | ArrayBufferView | File, rootUrl: string, onSuccess: (data: any, responseURL?: string) => void, onProgress?: (ev: ISceneLoaderProgressEvent) => void, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: LoadFileError) => void, name?: string) => IFileRequest’.
Types of parameters ‘onSuccess’ and ‘rootUrl’ are incompatible.
Type ‘string’ is not assignable to type ‘(data: any, responseURL?: string) => void’.
Are you sure you also upgraded the babylon loaders package to 6.9.0?
You’re right, in the package.json of loaders folder it says version 6.0.0. But I don’t use the loaders packages directly since I don’t need them (only using .babylon files). I’m using the ES6 version of babylonjs with the dependencies in my package.json:
I’ve also deleted the node_modules folder and installed all packages again with the same result.
Your error message is about
GLTFFileLoader, and there is a reference to
You should try to add the loader package in your json config file.
It helps, but without installing it as a direct dependency the package gets installed as a dependency of the inspector package. Shouldn’t the inspector use the latest version as its dependency?
Edit: Maybe it’s some weird npm cache thing. I’ve removed the loaders package and the inspector, run npm install, and added just the inspector again, and the loader version is still correct. And I’ve also run npm cache clean --force while testing multiple times without any effect on the result. But it seems to work now, thanks for your help.
cc @RaananW for the dependency management
yes, the inspector’s version should also be the same as the rest of the framework. Usually you wouldn’t notice if you are on the same major version, unless some internal functions changed their signature. What is the inspector’s version you are using?
I’m using the latest es6 version of the inspector 6.9.0 (“@babylonjs/inspector”: “6.9.0”)
will you be able to share the project?
No sorry can’t share. I just tried again, and I can’t reproduced this anymore, although nothing changed on my end.
I tried a few npm installs with just babylonjs and using “npm clean cache --force”, same as before.
Installing babylonjs 6.0.0 now installs the latest versions of all indirect dependencies (6.12.0, the ones not directly defined in my package.json, e.g. the loaders), although I don’t know why anyone would want to install the old version. Using 6.12.0. also installs the latest versions.
If I encounter this again I will report it, so for me this issue is solved.