Skip to content

Commit aeff82e

Browse files
improve type of fallback
1 parent 55de4f3 commit aeff82e

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/registry/routes/helpers/get-component-fallback.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import request from 'minimal-request';
44
import url from 'url';
55
import { Component, Config } from '../../../types';
66
import * as urlBuilder from '../../domain/url-builder';
7+
import { GetComponentResult } from './get-component';
78

89
type ComponentCallback = (
910
err: { registryError: any; fallbackError: any } | null,
@@ -77,14 +78,7 @@ export function getComponent(
7778
fallbackRegistryUrl: string,
7879
headers: IncomingHttpHeaders,
7980
component: { name: string; version: string; parameters: IncomingHttpHeaders },
80-
callback: (
81-
result:
82-
| {
83-
status: number;
84-
response: { code: string; error: Error };
85-
}
86-
| Component
87-
) => void
81+
callback: (result: GetComponentResult) => void
8882
): void {
8983
return request(
9084
{
@@ -94,7 +88,7 @@ export function getComponent(
9488
json: true,
9589
body: { components: [component] }
9690
},
97-
(err, res: Component[]) => {
91+
(err, res: GetComponentResult[]) => {
9892
if (err || !res || res.length === 0) {
9993
return callback({
10094
status: 404,

0 commit comments

Comments
 (0)