As part of the Web SDK npm package, we also ship appropriate typescript types. Sometimes we use some of their types in the Pictofit SDK (e.g. setting a color for a size visualisation overlay takes a BABYLON.Color3). To ensure the types are found even tho you are not importing them directly in your code, you will need to install the babylonjs package (which also contains the types) and add it to the types array in your tsconfig.json:

  "compilerOptions": {
    "types": [

Using Typescript >=4.3.2

Error: node_modules/babylonjs/babylon.module.d.ts:159173:29 - error TS2304: Cannot find name 'WebGLObject'.

Since Typescript v4.3.2 certain types / interfaces that were previously part of the DOM types lib (lib.dom.d.ts), were removed but are still used in BabylonJS types.

To circumvent this issue, we need to mock these types ourselves. We suggest adding a file like babylonjs-ts4.3.2-typefix.d.ts to your included typescript files and add the following in there:

interface WebGLObject {}
interface NavigatorUserMediaSuccessCallback {}
interface NavigatorUserMediaErrorCallback {}
interface OffscreenCanvasRenderingContext2D {}
interface OffscreenCanvas {}
interface MouseWheelEvent {}
interface MSGesture {}