-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Hello,
I really like NL cloud and wanted to give you a quick feedback in regards to the typing issues I'm facing. I'm using the summarization function, and the return type is hard to use and a bit confusing:
Promise<{
status: number;
statusText: string;
data: {
summary_text: string;
};
} | {
status: number;
statusText: string;
data: {
url: string;
}
}
TS is confused when I get the response back as it does not know if data contains an url or a summary_text. I'm not sure which case we get an url or a string, but would be nice to know in advance, otherwise a quick fix could look like this:
Promise<{
status: number;
statusText: string;
data: DataTypeText;
} | {
status: number;
statusText: string;
data: DataTypeUrl;
}
and simply export the data type so we can type it when we get back the response ourself, right now I'm simply using // @ts-ignore which I would like to avoid.
Metadata
Metadata
Assignees
Labels
No labels