Typescript error in drag files

const MANAGER = new THREE.LoadingManager();
function sceneCreator(url,rootPath,assetMap) {

    const baseURL = LoaderUtils.extractUrlBase(url);
    const blobURLs = [];
    return new Promise((resolve, reject)=>{
        MANAGER.setURLModifier((url,path)=>{
            const normalizedURL = rootPath + decodeURI(url)
            .replace(baseURL,'')
            .replace(/^(\.?\/)/, '');

            if(assetMap.has(normalizedURL)){
                const blob = assetMap.get(normalizedURL);
                const blobURL = URL.createObjectURL(blob);
                blobURLs.push(blobURL);
                return blobURL;
            }
            return (path || '') + url;
        });
        const loader = new GLTFLoader(MANAGER)
        .setCrossOrigin('anonymous');

        loader.load(url, (gltf)=>{
            const root = gltf.scene;
            console.log(root);
        })
    })

function to create simple dropzone

const input1 = document.querySelector("#file-input");
const dropArea = document.querySelector('.wrap') as HTMLElement || null;
const dropArea1 = document.querySelector('#c') as HTMLElement || null;

function createDropzone(){
    const drpCntrl = new SimpleDropzone(dropArea,dropArea1,input1);
    drpCntrl.on('drop',({files})=> load(files));
}
function load(fileMap){
    let rootPath;
    let rootFile;
    Array.from(fileMap).forEach(([path,file])=>{
        console.log('gggg',file.name);
        
        if(file.name.match(/\.(gltf|glb)$/)){
            rootFile = file;
            rootPath = path.replace(file.name, '');
        }
    })
    console.log(rootFile,rootPath);
    
    view(rootFile, rootPath, fileMap);
 }

 function view(rootFile, rootPath, fileMap){
    const fileURL = typeof rootFile === 'string'
    ? rootFile
    : URL.createObjectURL(rootFile);
    sceneCreator(rootFile,rootPath,fileMap);
 }

Below image it underlines url,path

Error -

(parameter) url: any

Parameter ‘url’ implicitly has an ‘any’ type, but a better type may be inferred from usage.ts(7044)

Argument of type ‘(url: any, path: any) => any’ is not assignable to parameter of type ‘(url: string) => string’.ts(2345)

(parameter) path: any

Parameter ‘path’ implicitly has an ‘any’ type, but a better type may be inferred from usage.ts(7044)

Argument of type ‘(url: any, path: any) => any’ is not assignable to parameter of type ‘(url: string) => string’.ts(2345)

Where is the issue or where I am doing wrong?

the issue is typescript, why not write ur codes in plane javascript?

from starting I am working in typescript but can’t able to debug this issue… you have any idea?

if url and path are both string type than

MANAGER.setURLModifier((url:string,path:string)=>{

now this error is come

(parameter) url: string

Argument of type ‘(url: string, path: string) => string’ is not assignable to parameter of type ‘(url: string) => string’.ts(2345)

Bugs in TS declaration files are reported here:

It is really a bug or my code problem?

You are not writing typescript. You are writing javascript in a .ts file.

The problem is quite straight foward. manager.setURLModifier accepts a callback function with one parameter of string type while you passed in two.

Thanks a lot… :slightly_smiling_face: