-
-
Save killthekitten/c62812fa69f2303201c36a9c2d26fd5e to your computer and use it in GitHub Desktop.
Strapi v5 TS integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import type { Modules, Schema, UID } from '@strapi/strapi'; | |
| export type GetValues<TSchemaUID extends UID.Schema> = | |
| Modules.Documents.Params.Attribute.GetValues<TSchemaUID>; | |
| export type GetDynamicZoneValues<TComponentUID extends UID.Schema> = | |
| GetValues<TComponentUID>; | |
| export type APIResponseData<TContentTypeUID extends UID.ContentType> = | |
| GetValues<TContentTypeUID>; | |
| export interface APIResponseCollectionMetadata { | |
| pagination: { | |
| page: number; | |
| pageSize: number; | |
| pageCount: number; | |
| total: number; | |
| }; | |
| } | |
| export interface APIResponse<TContentTypeUID extends UID.ContentType> { | |
| // FIXME: this won't be null most of the time, but it will be null in case of an optional upload attribute. | |
| // The Strapi utils cannot correctly infer this, so it is safer to assume all of data attributes may be null | |
| data: APIResponseData<TContentTypeUID> | null; | |
| } | |
| export interface APIResponseCollection< | |
| TContentTypeUID extends UID.ContentType | |
| > { | |
| data: APIResponseData<TContentTypeUID>[]; | |
| meta: APIResponseCollectionMetadata; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment