How to define export type in Typescript with Needle?

I am trying to integrate Google’s AR Model VIewer with Needle using this AR Renderer script as a starting point, making it into a .ts Behaviour/Component with Needle to see what works/doesn’t but I can’t get past this declaration of an export type which gives me the generic error Unexpected token. A constructor, method, accessor, or property was expected. in VS Code and I have exhausted all suggested workarounds I could find on Stackoverflow. Is there a certain way I should declare this type in Needle? Seems to be some kind of enum. WIP script attached for full reference, keen to get some really nice AR draggable sample together.

export type ARStatus =
    'not-presenting'|'session-started'|'object-placed'|'failed';

export const ARStatus: {[index: string]: ARStatus} = {
  NOT_PRESENTING: 'not-presenting',
  SESSION_STARTED: 'session-started',
  OBJECT_PLACED: 'object-placed',
  FAILED: 'failed'
};

Original Post on Discord

by user 103054507105067008

Has nothing to do with Needle to be honest, we’re not doing anything special.
Recommend you start by putting the ARRenderer.ts next to your component’s ts file, and get it to compile by throwing out things you don’t need

And/or pulling in additional files that seem useful / needed, e.g. Damper.js or PlacementBox.js

Will do, just was wondering why that export type had some declaration in some way that typescript didn’t like. I’ll strip it right back

by user 103054507105067008

Are you declaring the type twice there?

I see ARStatus being used multiple times

as a variable and a type

I just realised the export types need to be outside of the class the rest of the code is in :slightly_smiling_face:

by user 103054507105067008

Not really

Oh I see what else was causing it, a nested class and exports within the class above it

by user 103054507105067008

See my message above, I recommend you put that script next to your component and not into it, and once it’s compiling again you can import it and work with that

Proper attachment, marked this as answered for now, will share any working samples I get out of this!
ARRenderer.ts

by user 103054507105067008