TypeScript compiler could not see Object3D properties in a subclass

I’m developing in JavaScript, not Typescript, but I have enabled checkJs in jsconfig.json to let the TSC to check my types. I have a few classes that inherit from Object3D. The TSC always complained that ‘this.position’, ‘this.rotation’ etc did not exist. Using ‘super.position’ seemed to work OK. Is it supposed to be basic OOP?

weird thing is that the editor, VSC, was OK with the syntax, even with TypeScript checking turned on.

three has no types, there’s no position or rotation. you can optionally npm install @types/three which now would allow you to benefits from IDE auto complete and type hover, also type your code of course.

but imo this all is a bit strange. what is jsconfig.json for? you normally don’t need to do anything, if the file ends in *.js it will auto complete and give you contextual info but not complain about types. if the extension is *.ts it will start to check types. in a modern build tool like vite this is all you have to do.

jsconfig is not required strictly for coding, but it helps for running tsc from command line or for VSC to start checking the type usages in js files. But thanks for mentioning @types/three. VSC seemed has silently installed the type file so it knew about Object3D. The tsc did not see it that’s why it complained. Thanks a lot!