SkyMaterial in TypeScript

Hi!
I’m new to using BabylonJS, a novice developer, and I’m trying to get used to the basics.
I’m trying to get this playground going in a local TypeScript project:

https://playground.babylonjs.com/#E6OZX#221

I’m importing SkyMaterial as follows:

import { SkyMaterial } from ‘babylonjs-materials’;

Lines 22 - 29 of the playground results in errors I can’t seem to fix:

Property ‘backFaceCulling’ does not exist on type ‘SkyMaterial’

and:

Type ‘SkyMaterial’ is missing the following properties from type ‘Material’: customShaderNameResolve, shadowDepthWrapper, allowShaderHotSwapping, id, and 99 more.

I tried casting SkyMaterial to Material to get the first error out of the way, but doing so for line 29 of the playground code causes errors to occur and no SkyMaterial to be visible…

Does anyone know what I should do to make this work with TypeScript?

Pinging @sebavan

This should work, could you ensure you are using consistent version of the npm packages ?

all babylonjs and babylonjs-materials or all @babylonjs/core and @babylonjs/materials and the same exact versions?

A repro would be perfect to help.

1 Like

Double checked, changed import to:

import { SkyMaterial } from ‘@babylonjs/materials’

and it works now, thanks!

1 Like