Skip to content

Commit

Permalink
Remove type casting
Browse files Browse the repository at this point in the history
  • Loading branch information
gzdunek committed Mar 29, 2024
1 parent 9b1f82f commit 83fe593
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export class ResourcesService {
async listUnifiedResources(
params: types.ListUnifiedResourcesRequest,
abortSignal: AbortSignal
) {
): Promise<{ nextKey: string; resources: UnifiedResourceResponse[] }> {
const { response } = await this.tshClient.listUnifiedResources(params, {
abort: cloneAbortSignal(abortSignal),
});
Expand All @@ -184,28 +184,28 @@ export class ResourcesService {
.map(p => {
if (resourceOneOfIsServer(p.resource)) {
return {
kind: 'server',
kind: 'server' as const,
resource: p.resource.server,
};
}

if (resourceOneOfIsDatabase(p.resource)) {
return {
kind: 'database',
kind: 'database' as const,
resource: p.resource.database,
};
}

if (resourceOneOfIsApp(p.resource)) {
return {
kind: 'app',
kind: 'app' as const,
resource: p.resource.app,
};
}

if (resourceOneOfIsKube(p.resource)) {
return {
kind: 'kube',
kind: 'kube' as const,
resource: p.resource.kube,
};
}
Expand All @@ -214,7 +214,7 @@ export class ResourcesService {
`Ignoring unsupported resource ${JSON.stringify(p)}.`
);
})
.filter(Boolean) as UnifiedResourceResponse[],
.filter(Boolean),
};
}
}
Expand Down

0 comments on commit 83fe593

Please sign in to comment.