Skip to content

[feat]: Make strapi client use types from contentTypes.d.ts #114

@mb21

Description

@mb21

Unless I'm missing something this is currently not possible?

In the typescript example you're repeating the types, which were already generated here?

Why should this feature be included?

Because I don't want to copy over the generated types.

Please provide an example for how this would work

Ideally the strapi client construct would be generic, and we could pass it something exported by contentTypes.d.ts?

import type { API } from "../.strapi/types/generated/contentTypes.d.ts";
import { strapi } from "@strapi/client";

const client = strapi<API>({ baseURL: "http://localhost:1337/api" });

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions