Typescript Import error, am I doing it wrong?

Hey guys, I’ve been plugging along just fine so far getting a scene, stage and camera set up nicely. However, when I attempt to set up an action manager, it says that the Scene type is incorrect.

It almost looks like I have to versions of Babylon imported or something.

Has anyone else had this issue? Is there a decent way to fix it?

Maybe @sebavan would be able to help on this one.

I think you may want to show how you import Babylon types (“import { AbstractActionManager, Scene, … } …”) as it could help pinpoint the problem.

Ahh, thank you @Evgeni_Popov.

You set me on the right track, I am doing this import everywhere else:

import * as BABYLON from 'babylonjs';

Attempting to do a named import in this file:

import { AbstractActionManager, Scene, AbstractScene } from 'babylonjs';

It is a little ominous that the two imports can cause type errors to occur, but atleast I know what the problem is now. Thanks again

With this import, you should use the type names directly without prefixing them by BABYLON as you do in the screenshot above.

2 Likes