IPropagation is a type gathering all possible status codes and their body
data types as a discriminated union type. You can specify the status code and
its body data type just by using conditional statement like below.
constoutput: Output = awaitsdk.sellers.authenticate.join(input); if (output.success) { // automatically casted to "ISeller.IAuthorized" type constauthorized: ISeller.IAuthorized = output.data; } elseif (output.status === 400) { // automatically casted to "TypeGuardError.IProps" type consterror: TypeGuardError.IProps = output.data; } else { // unknown type when out of pre-defined status codes constresult: unknown = output.data; }
For reference, this IPropagation type is utilized by SDK library generated by
@nestia/sdk, when you've configured INestiaConfig.propagate to be true.
In that case, SDK functions generated by @nestia/sdk no more returns response DTO
typed data directly, but returns this IPropagation typed object instead.
Propagation type.
IPropagation
is a type gathering all possible status codes and their body data types as a discriminated union type. You can specify the status code and its body data type just by using conditional statement like below.For reference, this
IPropagation
type is utilized by SDK library generated by@nestia/sdk
, when you've configured INestiaConfig.propagate to betrue
. In that case, SDK functions generated by@nestia/sdk
no more returns response DTO typed data directly, but returns thisIPropagation
typed object instead.