Slice Machine TypeScript


We need absolutly to work with typescript for generated slice machines.
We are using nextjs project.
prismic-ts-codegen generate us just a file types.generated.ts.
It seem there is solution for automatic generation of TSX files for slice machine.
Please what we need to do ?


Hello, here's the official Slice Machine and typescript documentation. Please refer to the

Plase refer to the issue tracker for any related topics

Hey team! We're glad to announce that Slice Machine v0.5.1 is out !!
Let's celebrate the native support of TypeScript Types in Slice Machine! And a lot of cool UX/UI improvements and bug fixes!

Big shoutout to the whole team and @haberer.lucie and @angeloashmore for their contribution with the TS integration.

Now, let's play with it and make great websites! Full changelog here.

1 Like

@Phil Amazing.
I had missed something for sure.
I'm based from the last next demo project and upgraded slice machine version to 0.5.1 and and I have installed "@prismicio/types": "^0.2.3" and all last packages versions.
Content object is not recognized automatically with import { Content } from "@prismicio/client";
Any idea ?

I'm not 100% sure @ali I haven't had time to test this myself. You can check out the new docs to see if that helps. If not I'll reach out to the team for more help.

I had followed the Doc without sucess.
I will use the old import till we find a solution about.

Lucie discusses importing content here:

I'll see if she has any more information for us.

I have the same issue. I can see the new file getting generated but doing

import { Content } from "@prismicio/client";

as suggested doesn't pick up on it.

Hey @tim5 & @ali ,

We noticed that one and turns out we overlooked the location of generated types with the tsconfig.json
You should be able to fix it by adding this option to your tsconfig.json:

"include": [

Then after adding that, CMD+SHIFT+P -> TypeScript: Reload Project

1 Like

This worked for me.

1 Like