1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #7041: Properly format JSON config object returned from a NAPALM device

This commit is contained in:
thatmattlove
2021-08-31 23:56:18 -07:00
parent d743dc160a
commit 14d87a3584
14 changed files with 82 additions and 27 deletions

View File

@ -19,7 +19,9 @@ export function isApiError(data: Record<string, unknown>): data is APIError {
return 'error' in data && 'exception' in data;
}
export function hasError(data: Record<string, unknown>): data is ErrorBase {
export function hasError<E extends ErrorBase = ErrorBase>(
data: Record<string, unknown>,
): data is E {
return 'error' in data;
}