diff options
author | Dj <43033058+DjDeveloperr@users.noreply.github.com> | 2023-04-04 00:02:21 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-03 21:32:21 +0300 |
commit | 62c566469710ba610df764df0ee6560295532e4b (patch) | |
tree | 5abd4547b40fa9b2fa89afe4a057a9c556759005 /cli/tsc | |
parent | 51d3fb78ad2453e649d01bcc833ecfec1a05d685 (diff) |
feat(ext/ffi): support marking symbols as optional (#18529)
Diffstat (limited to 'cli/tsc')
-rw-r--r-- | cli/tsc/dts/lib.deno.unstable.d.ts | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/cli/tsc/dts/lib.deno.unstable.d.ts b/cli/tsc/dts/lib.deno.unstable.d.ts index b82a80382..4bc0fed45 100644 --- a/cli/tsc/dts/lib.deno.unstable.d.ts +++ b/cli/tsc/dts/lib.deno.unstable.d.ts @@ -271,6 +271,11 @@ declare namespace Deno { * * @default {false} */ callback?: boolean; + /** When `true`, dlopen will not fail if the symbol is not found. + * Instead, the symbol will be set to `null`. + * + * @default {false} */ + optional?: boolean; } /** **UNSTABLE**: New API, yet to be vetted. @@ -282,6 +287,11 @@ declare namespace Deno { name?: string; /** The type of the foreign static value. */ type: Type; + /** When `true`, dlopen will not fail if the symbol is not found. + * Instead, the symbol will be set to `null`. + * + * @default {false} */ + optional?: boolean; } /** **UNSTABLE**: New API, yet to be vetted. @@ -336,7 +346,9 @@ declare namespace Deno { * @category FFI */ type StaticForeignLibraryInterface<T extends ForeignLibraryInterface> = { - [K in keyof T]: StaticForeignSymbol<T[K]>; + [K in keyof T]: T[K]["optional"] extends true + ? StaticForeignSymbol<T[K]> | null + : StaticForeignSymbol<T[K]>; }; const brand: unique symbol; |