From b08a86e4d4283095d73330777983e814a4d202cb Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Wed, 18 Jan 2023 02:21:47 -0500 Subject: [PATCH] fix: handle null return values --- packages/js/core/src/interfaces/uri-resolver.ts | 8 ++++---- .../src/UriResolverExtensionFileReader.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/js/core/src/interfaces/uri-resolver.ts b/packages/js/core/src/interfaces/uri-resolver.ts index 2be4064cbf..9690c02299 100644 --- a/packages/js/core/src/interfaces/uri-resolver.ts +++ b/packages/js/core/src/interfaces/uri-resolver.ts @@ -4,8 +4,8 @@ import { Tracer } from "@polywrap/tracing-js"; import { Result } from "@polywrap/result"; export interface MaybeUriOrManifest { - uri?: string; - manifest?: Uint8Array; + uri?: string | null; + manifest?: Uint8Array | null; } export const module = { @@ -32,8 +32,8 @@ export const module = { invoker: Invoker, wrapper: Uri, path: string - ): Promise> => { - return invoker.invoke({ + ): Promise> => { + return invoker.invoke({ uri: wrapper.uri, method: "getFile", args: { diff --git a/packages/js/uri-resolver-extensions/src/UriResolverExtensionFileReader.ts b/packages/js/uri-resolver-extensions/src/UriResolverExtensionFileReader.ts index b367d8df4d..67145192fe 100644 --- a/packages/js/uri-resolver-extensions/src/UriResolverExtensionFileReader.ts +++ b/packages/js/uri-resolver-extensions/src/UriResolverExtensionFileReader.ts @@ -34,7 +34,7 @@ export class UriResolverExtensionFileReader implements IFileReader { path ); if (!result.ok) return result; - if (result.value === undefined) { + if (!result.value) { return ResultErr(new Error(`File not found at ${path}`)); } return {