-
Notifications
You must be signed in to change notification settings - Fork 7
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
[feat]: GenericDocumentResponse has not public export #53
Comments
Hey, thanks for opening this issue. The current behavior is actually the correct one. We're exporting types depending on precise needs to solve precise issues and try to avoid dumping all the internal types in the I've switched the issue to a feature request. In the meantime, could you elaborate the use cases and why you think it's important to give access to this type? I think I kinda get why it could be interesting to have them, but could you share a snippet where you would use this? Thanks! |
Hey, thanks for your answer: here small sample: I need to add @ts-ignore to use typed GenericMultiDocumentResponse |
Yeah, that makes sense, however I'm not a fan of this type's name We probably need to figure out a better public name to represent a generic document (or collection of document) response. I'm not sure what offers the best DX: import { Response } from '@strapi/client'
const doc: Response.Document;
const col: Response.DocumentCollection; or import { DocumentResponse, DocumentCollectionResponse } from '@strapi/client'
const doc: DocumentResponse;
const col: DocumentCollectionResponse; or something completely different 🤔 |
I would go with |
Bug Description
If i use following TS code:
import { GenericDocumentResponse } from '@strapi/sdk-js/dist/types/content-api';
const response: GenericDocumentResponse = await collection.find({ locale: locale.locale, populate: ['catalog'] });
I get TS warning:
TS2307: Cannot find module @strapi/ sdk-js/ dist/ types/ content-api or its corresponding type declarations.
Could add GenericDocumentResponse in public export
Steps to Reproduce
Expected Behavior
No TS warnings
Version
1.0.0
Operating System
Windows
Runtime Environment
Node.js
Logs
Media
No response
Confirmation Checklist
The text was updated successfully, but these errors were encountered: