Property 'renderOutline' does not exist on type 'Mesh'.ts

I have this weird problem in VSCode:

Property ‘renderOutline’ does not exist on type ‘Mesh’.ts(2339)

In the playground it works fine. I was just trying to set renderOutline to true.

How are you importing Mesh? Can you post example code or playground?

Import like this: import { Mesh } from “@babylonjs/core/Meshes/mesh”;

Here is the code:

const path = [new Vector3(0, 0.5, 0), new Vector3(0, -0.5, 0)];

const tube = MeshBuilder.CreateTube(
    "",
    { path: path, radius: 0.5 },
    scene
  );

  tube.visibility = 0.000000001;
  tube.renderOutline = true;
  tube.outlineWidth = 0.009;
  tube.outlineColor = new Color3(0, 0.82, 0.45);

The playground won’t show the problem because there is no such problem in the playground.

Is it just VSCode flagging it visually or do you also get the same error when transpiling with tsc / building your project?

Just the red wiggly lines but I have not tested the code.

Hmmm, unsure, but if it’s just VSCode complaining, try restarting VSCode, clearing node_modules and/or rerunning npm install.

Still shows the wiggly lines unfortunately.

You may also need to import side effects:

import '@babylonjs/core/Rendering/outlineRenderer'

3 Likes

It solved it. Kinda weird though.

Cool. Yes this sort of thing has tripped me up a few times, although I’ve not used renderOutline before.

There’s some documentation about it here:

1 Like