Hi folks! As I dig into lite physics, I’m running afoul of TS error 2748:
Cannot access ambient const enums when ‘verbatimModuleSyntax’ is enabled.
Physics has constants of this style:
export declare const enum PhysicsShapeType {
SPHERE = 0,
CAPSULE = 1,
CYLINDER = 2,
BOX = 3,
CONVEX_HULL = 4,
CONTAINER = 5,
MESH = 6,
HEIGHTFIELD = 7
}
A functionally equivalent declaration could be:
export const PhysicsShapeType = {
SPHERE: 0,
CAPSULE: 1,
CYLINDER: 2,
BOX: 3,
CONVEX_HULL: 4,
CONTAINER: 5,
MESH: 6,
HEIGHTFIELD: 7,
} as const;
export type PhysicsShapeType = (typeof PhysicsShapeType)[keyof typeof PhysicsShapeType];
I’ve confirmed this works as a drop-in substitute in my code. However, I wasn’t able to easily verify the performance impact of such a change, as running pnpm test on my machine results in several failures, even on an unmodified clone of the master branch
.
So, my question is: Have you already considered this issue? I’ve been using verbatimModuleSyntax without issue for about 18 months. With some light searching, it seems that there’s different opinions on this flag, although it seems that Vite (which I use) has better build performance when it is set.
Thanks for your insight!
Any tips for getting reliable results out of pnpm test? I have a pretty high end laptop that’s about a year old.