Open underfisk opened 1 year ago
Bumping
@underfisk sorry but could you clarify what you are receiving that doesn't match the interface ILayoutPaginationResponse
when using the Node SDK functionality novu.layouts.list
?
https://github.com/novuhq/novu/blob/f596c26ba247889edd1d1b687c7a944792f7b024/packages/node/src/lib/layouts/layout.interface.ts#L44
@p-fernandez @scopsy, Seem to me like @underfisk is explicitly typing fff
(possibly inferred by the editor for whatever reason) as ILayoutPaginationResponse
in the example above and referencing fff.data
where fff
is actually an AxiosResponse
with data
type -> ILayoutPaginationResponse
Whereas, Correct use on the user's end should look like so:
import { AxiosResponse } from "axios";
//@ts-ignore
const fff: AxiosResponse<ILayoutPaginationResponse> = await novu.layouts.list({
page: 0,
pageSize: 100,
});
fff.data.data // now you can see the right hint as you type
@p-fernandez Is there any documentation on how to use types like ILayoutPaginationResponse
?https://github.com/novuhq/novu/blob/f596c26ba247889edd1d1b687c7a944792f7b024/packages/node/src/lib/layouts/layout.interface.ts#L44 I can see it's just a public type as it isn't used internally. Or was this written for future internal use?
This seems to be all tied to the fact that most methods don't have explicit return types.
Happy to make a PR
Also see https://github.com/novuhq/novu/issues/3928#issuecomment-1671909148
@jainpawan21 I think that you have made some adjustments based on that recently, any thoughts on this one?
@jainpawan21 I think that you have made some adjustments based on that recently, any thoughts on this one?
This should not happen i will check this
Assigning this to myself
What's the status on this @jainpawan21 :)
📜 Description
Noticed while using the Novu Nodejs SDK that when attempting to fetch a list of layouts, the response DTO does not match the API response
👟 Reproduction steps
novu.layouts.list({ your params})
👍 Expected behavior
The interface should reflect the actual API response
👎 Actual Behavior with Screenshots
You'll observe that
list
will have the following content:When inspecting with my IDE, this is what I see:
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
🏢 Have you read the Contributing Guidelines?
Are you willing to submit PR?
Yes I am willing to submit a PR!