Skip to content

[feat]: Type arguments #82

@kasperjha

Description

@kasperjha

A clear and concise description of what the feature is

Issue #45 mentions autogenerated types based on the API schema. While that's a nice feature I also find that these solutions adds some complexity to the code. strapi-sdk-js takes a simpler approach by supporting passing type arguments to API methods.

strapi.find<BlogPost>(...)

This works well for me. I often have simple types that i don't mind defining myself. Additionally i can retain full control over the type definitions and reuse them in other application code if I find this useful.

Why should this feature be included?

For my projects this implementation is not suitable until it is strongly typed. I prefer typed arguments as a solution, but i don't think that should be incompatible with what's been outlined in #45.

To be clear, strapi-sdk-js suits all my needs at the moment, but these third-party SDKs are prone to lagging behind on API compatibility, so I would really like to see a well-maintained first party package.

Please provide an example for how this would work

See examples in strapi-sdk-js as well as snippet above.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions