Using management API with TypeScript and intellisense?

Hey all, i’m using the CMA from TypeScript and would like to see some type information for things like Environment, Entry, etc.
It seems like in there is an index.d.ts file in the ‘node_modules’ folder ‘contentful’, but no such thing in ‘contentful-management’.

Hi aldub!

What version of the CMS SDK are you using? Typescript typings were added in version 5.10.0.

Hi Rouven, thanks for your reply. Indeed we had an older version, and after upgrading to 5.11.2, we get most of the types! However some of the types seem to be missing. For example, in contentFields.d.ts, i would expect to see a “validations” field:

export interface ContentFields {
id: string,
name: string,
required: boolean,
localized: boolean,
type: string,
}

Is this to be found somewhere else or will it be fixed in a newer version?

That looks like a bug. I see that you already opened an issue on the GitHub repo, that’s the best way to go to get this resolved.

1 Like