Hit Test sample scene doesn't work in local project

I’m trying to create a WebXR app for the Meta Quest 2. I used the sample project from raanan to set up babylon.js locally and everything works fine. Next I wanted to try out the AR hit test sample (which works when I start it in the playground) as a new scene and tried to translate the javascript code to typescript. But on this part…

xrTest.onHitTestResultObservable.add((results) => {
            if (results.length) {
                marker.isVisible = true;
                const hitTest = results[0];
            } else {
                marker.isVisible = false;

…intellisense tells me on xrTest “Property ‘onHitTestResultObservable’ does not exist on type ‘IWebXRFeature’.” I don’t really understand the problem, since it works in javascript. What exactly is the problem and how should I fix it?
Also, is there a way to save a playground as a typescript file? Or generally speaking, how should I proceed if I wanted to save a playground scene as a typescript file, which I can then use in my project?

I don’t know too much so @RaananW would be able to answer better but for Typescript, you might just need to cast the xrTest object to type IWebXRHitTestFeature since the default type, IWebXRFeature doesn’t have access to onHitTestResultObservable.


Thanks, now it’s working!