Skip to content

[feat]: Type arguments #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kasperjha opened this issue May 5, 2025 · 0 comments
Open

[feat]: Type arguments #82

kasperjha opened this issue May 5, 2025 · 0 comments
Labels
issue: enhancement source: client-types Source is types status: need research The feature or enhancement needs more research before being accepted

Comments

@kasperjha
Copy link

kasperjha commented May 5, 2025

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.

@Convly Convly added source: client-types Source is types status: need research The feature or enhancement needs more research before being accepted labels May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: enhancement source: client-types Source is types status: need research The feature or enhancement needs more research before being accepted
Projects
None yet
Development

No branches or pull requests

2 participants