Create CollectionTypes types/interfaces from schema.d.ts

I don’t know if we should use it, but you can use it like this:

export type User = GetAttributesValues<'plugin::users-permissions.user'>;

Unfortunately, there is no id field in this type.

But this following type can fix this:

export type GetModelType<T extends SchemaUID> = {
  id: number;
} & GetAttributesValues<T>;

export type User = GetModelType<'plugin::users-permissions.user'>;
1 Like