summaryrefslogtreecommitdiff
path: root/cli/tsc
diff options
context:
space:
mode:
authorDj <43033058+DjDeveloperr@users.noreply.github.com>2023-01-07 19:58:10 -0800
committerGitHub <noreply@github.com>2023-01-08 09:28:10 +0530
commitad82918f56b215a428ebe7c533ee825e1152d1b4 (patch)
tree2669f9d8d419a88e9d58b12b98579e884aec6988 /cli/tsc
parent84ef26ac9b5f0e1199d77837cd97cb203baa8729 (diff)
feat(ext/ffi): structs by value (#15060)
Adds support for passing and returning structs as buffers to FFI. This does not implement fastapi support for structs. Needed for certain system APIs such as AppKit on macOS.
Diffstat (limited to 'cli/tsc')
-rw-r--r--cli/tsc/dts/lib.deno.unstable.d.ts24
1 files changed, 19 insertions, 5 deletions
diff --git a/cli/tsc/dts/lib.deno.unstable.d.ts b/cli/tsc/dts/lib.deno.unstable.d.ts
index d34a5bd62..e3ae8f46f 100644
--- a/cli/tsc/dts/lib.deno.unstable.d.ts
+++ b/cli/tsc/dts/lib.deno.unstable.d.ts
@@ -95,6 +95,13 @@ declare namespace Deno {
type NativeVoidType = "void";
/** **UNSTABLE**: New API, yet to be vetted.
+ *
+ * The native struct type for interfacing with foreign functions.
+ *
+ */
+ type NativeStructType = { readonly struct: readonly NativeType[] };
+
+ /** **UNSTABLE**: New API, yet to be vetted.
*
* All supported types for interfacing with foreign functions.
*
@@ -106,7 +113,8 @@ declare namespace Deno {
| NativeBooleanType
| NativePointerType
| NativeBufferType
- | NativeFunctionType;
+ | NativeFunctionType
+ | NativeStructType;
/** **UNSTABLE**: New API, yet to be vetted.
*
@@ -136,7 +144,9 @@ declare namespace Deno {
*
* @category FFI
*/
- type ToNativeType<T extends NativeType = NativeType> = ToNativeTypeMap[T];
+ type ToNativeType<T extends NativeType = NativeType> = T extends
+ NativeStructType ? BufferSource
+ : ToNativeTypeMap[Exclude<T, NativeStructType>];
/** **UNSTABLE**: New API, yet to be vetted.
*
@@ -153,7 +163,8 @@ declare namespace Deno {
* @category FFI
*/
type ToNativeResultType<T extends NativeResultType = NativeResultType> =
- ToNativeResultTypeMap[T];
+ T extends NativeStructType ? BufferSource
+ : ToNativeResultTypeMap[Exclude<T, NativeStructType>];
/** **UNSTABLE**: New API, yet to be vetted.
*
@@ -193,7 +204,9 @@ declare namespace Deno {
*
* @category FFI
*/
- type FromNativeType<T extends NativeType = NativeType> = FromNativeTypeMap[T];
+ type FromNativeType<T extends NativeType = NativeType> = T extends
+ NativeStructType ? Uint8Array
+ : FromNativeTypeMap[Exclude<T, NativeStructType>];
/** **UNSTABLE**: New API, yet to be vetted.
*
@@ -212,7 +225,8 @@ declare namespace Deno {
* @category FFI
*/
type FromNativeResultType<T extends NativeResultType = NativeResultType> =
- FromNativeResultTypeMap[T];
+ T extends NativeStructType ? Uint8Array
+ : FromNativeResultTypeMap[Exclude<T, NativeStructType>];
/** **UNSTABLE**: New API, yet to be vetted.
*