Importing "earcut" to playground in typescript?

I am going through the tutorial outlined here using typescript.

However, this might not work, as there’s a snippet in the article which says:

If you are using TypeScript then you can inject the earcut algorithm as the earcutInjection parameter on the extudePolygon function.

Could more be said about how to do this, please? The link provided is dead, and I assume that the actual link should be this.
It specifies the type as “any” so I have no further clues for what is needed to go here.

This is not needed in the playground, this is if you are using earcut as a dependency and not the global variable.

In the playground, it should be available for you.

cc @RaananW

earcut is an external dependency that needs to be imported by you if you use it in your experience.
When you import earcut you need to pass the imported object to the function as the last variable (which is earcutInjection).

So in your code you should have something like this:

import * as earcut from "earcut"; // might be 'import earcut from "earcut"', depending on the earcut package definition


ExtrudePolygon("name", {}, scene, earcut);

Thanks for this info! For some reason, the polygon shape being extruded didn’t extrude properly, so I focused in on the earcut + typescript recommendation. What actually happened was that I forgot to push an additional two coordinates into the path array. Good to know that the dependency is still there even if written in ts, which makes sense on the surface! It should all compile from javascript in the end.