Answers about typescript
Questions and answers from the Croct community about typescript.
Best way to get typed slot content in a TypeScript Hydrogen project?
Our Hydrogen storefront is strict TypeScript, no implicit any, and I would like slot content to be typed end to end rather than casting the fetch result to…
Should I commit the generated slots.d.ts or let it regenerate on each build?
Project uses typed slot content. The CLI generates a slots.d.ts file. Deciding between two options. gitignore it and regenerate in CI, or commit it. Not sure…
typescript-eslint no-floating-promises flags every croct.track and croct.identify call
Enabled the strict typescript-eslint preset. Result: on every croct.track() and croct.identify() in the codebase. Before I blanket-void them: is awaiting…
How should croct.json5 version specifiers and slots.d.ts play with CI builds?
Setting up CI for a Next.js project and I want the Croct typing story fully deterministic. Three questions: How exactly do version specifiers in croct.json5…
Added a new slot in the dashboard, TypeScript says the slot ID does not exist
Created a promo-banner slot in the dashboard ten minutes ago, referenced it in code, and tsc is having none of it: We run strict everything so I can't just…
One croct.json5 for the whole pnpm workspace or one per Next.js app?
We run two Next.js applications in a single pnpm workspace. Both belong to the same Croct workspace, but they use entirely different slots. I am setting up…
How do Strapi component fields relate to Croct component schemas?
Strict TypeScript project, and I care a lot about having one source of truth for types. Our Strapi components are typed end to end today. If I map a Strapi…
Combining sanity typegen with the generated slots.d.ts, one type system or two?
We use sanity typegen to type all our GROQ results, and now the Croct CLI has generated a slots.d.ts in the repo. So I have two generated type sources…
What error format does the Croct HTTP API return? Building a typed client
Writing a thin typed client for the Content and Evaluation APIs. Need the error envelope. Is it consistent across endpoints or per-endpoint shapes? Want to…