Skip to content

Commit

Permalink
fix(ext/ffi): pointer type can accept null (denoland#13335)
Browse files Browse the repository at this point in the history
  • Loading branch information
DjDeveloperr authored Jan 11, 2022
1 parent 5680d33 commit a7ea93b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cli/dts/lib.deno.unstable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ declare namespace Deno {

type StaticForeignFunctionParameter<T> = T extends "void" ? void
: T extends StaticNativeNumberType ? number
: T extends "pointer" ? Deno.UnsafePointer | Deno.TypedArray
: T extends "pointer" ? Deno.UnsafePointer | Deno.TypedArray | null
: unknown;

/** Infers a foreign function parameter list. */
Expand Down
2 changes: 1 addition & 1 deletion test_ffi/tests/ffi_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ remote.symbols.method14(null);
remote.symbols.method14(0);

// @ts-expect-error: Invalid argument
remote.symbols.method15(null);
remote.symbols.method15(0);
remote.symbols.method15(new Uint16Array(1));
remote.symbols.method15({} as Deno.UnsafePointer);

Expand Down

0 comments on commit a7ea93b

Please sign in to comment.