refactor(shared): simplify normalize SDK null guards
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -7,7 +7,7 @@ export function normalizeSDKResponse<TData>(
|
|||||||
fallback: TData,
|
fallback: TData,
|
||||||
options?: NormalizeSDKResponseOptions,
|
options?: NormalizeSDKResponseOptions,
|
||||||
): TData {
|
): TData {
|
||||||
if (response === null || response === undefined) {
|
if (response == null) {
|
||||||
return fallback
|
return fallback
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ export function normalizeSDKResponse<TData>(
|
|||||||
|
|
||||||
if (typeof response === "object" && "data" in response) {
|
if (typeof response === "object" && "data" in response) {
|
||||||
const data = (response as { data?: unknown }).data
|
const data = (response as { data?: unknown }).data
|
||||||
if (data !== null && data !== undefined) {
|
if (data != null) {
|
||||||
return data as TData
|
return data as TData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user