Argument of type 'import("babylonjs/scene").Scene' is not assignable to parameter of type 'BABYLON.Scene'

Hi, I got this error “Argument of type ‘import(“babylonjs/scene”).Scene’ is not assignable to parameter of type ‘BABYLON.Scene’.” How can I fix it?

class Game {
	private _scene: Scene;
	private _canvas: HTMLCanvasElement;
	private _engine: Engine;

	constructor() {
		this._canvas = this._createCanvas();
		this._createScene();
		this._example();
	}

	private _createCanvas() {
		this._canvas = document.createElement('canvas');
		this._canvas.style.width = '100%';
		this._canvas.style.height = '100%';
		this._canvas.id = 'gameCanvas';
		document.body.appendChild(this._canvas);
		return this._canvas;
	}

	private _createScene() {
		this._engine = new Engine(this._canvas, true);
		this._scene = new Scene(this._engine);

		this._engine.runRenderLoop(() => {
			this._scene.render();
		});
		window.addEventListener('resize', () => {
			this._engine.resize();
		});
	}

	private _example() {
		let scene = new Scene(this._engine);
		const camera = new BABYLON.ArcRotateCamera(
			'camera',
			-Math.PI / 2,
			Math.PI / 2.5,
			3,
			new BABYLON.Vector3(0, 0, 0),
			scene,
		);
		camera.attachControl(this._canvas, true);

		const light = new BABYLON.HemisphericLight('light', new BABYLON.Vector3(0, 1, 0), scene);

		const box = BABYLON.MeshBuilder.CreateBox('box', {});
	}
}
new Game();

You can not mix imports and global namespace in one project you should either use BABYLON. everywhere or import … from to rely on babylon objects

I’m kinda new to this. What do you mean?

In your code I can see: new Scene meaning here you probably have a import { scene } from ... in your file.

I also see new BABYLON.ArcRotateCamera... and other BABYLON... statements.

Unfortunately those two ways of interacting with Babylon are not compatible. I you are new to it, always using BABYLON. without import might be simpler.

If you are used to JS, just import everything.