You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently to get correct typing for a getContent query using @plone/client, we have to do something like the following:
typeCustomContentTypeExtraFields={title_number: number;};typeCustomContentType=Content&CustomContentTypeExtraFields;const{ data }: {data: CustomContentType}=useSuspenseQuery(getContentQuery({path: flattenToAppURL(pathname)}));
Having to do { data }: { data: CustomContentType } is a little verbose and becomes even more so once you destructure additional keys from the query. You can do something like const customData = data as CustomContentType, but it's still extra code
Proposed solution
Allow getContentQuery to be passed a generic for it's return type. E.g. getContentQuery<CustomContentType>({ path: flattenToAppURL(pathname) })
The text was updated successfully, but these errors were encountered:
@JeffersonBledsoe let's talk, because what you are saying it's not true. In the PoCs the typings are gotten right. I can show you anytime. It worked right the last time, and if it's not, we have a regression. This is the magic of using TanStack Query...
Is your feature request related to a problem? Please describe.
Currently to get correct typing for a
getContent
query using@plone/client
, we have to do something like the following:Having to do
{ data }: { data: CustomContentType }
is a little verbose and becomes even more so once you destructure additional keys from the query. You can do something likeconst customData = data as CustomContentType
, but it's still extra codeProposed solution
Allow
getContentQuery
to be passed a generic for it's return type. E.g.getContentQuery<CustomContentType>({ path: flattenToAppURL(pathname) })
The text was updated successfully, but these errors were encountered: