I’m trying to import my generated types on the frontend.
import { bulldogblast } from "../../declarations/bulldogblast"
This is working, I can call functions on my canister using
await bulldogblast.<function>
One of those function calls requires a type.
const result = await bulldogblast.input(parseInt(gameID), 1, {commandType: "Thrust", vector: directionVector, player: 1}
fails because "Thrust"
doesn’t match the invariant of "Fire; Thrust";
I tried sending a symbol, failed, integer (hoping the enm would match), that failed the invariant check too.
So I look into importing types, following the thread here: Best way to use generated declarations in JS / reactJS frontend? I tried in my javascript:
import { InputCommand, InputCommandTypes } from "../../declarations/bulldogblast/bulldogblast.did";
and I get a webpack error:
"Module parse failed: Unexpected token
You may need an apppropriate loader to handle this file type, currently no loaders are configured to process this file.
> type Velocity =
record {
x: float 64;
so my type import is failing.
How do I access my types in the frontend?