From c2f97494f770dc36c0cacdb839f953b00e916e2c Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Tue, 10 Sep 2024 05:04:59 -0700 Subject: [PATCH] refactor: move WebGPU, FFI and FS typings from unstable to stable (#25488) Closes #25377 --- cli/tsc/dts/lib.deno.ns.d.ts | 689 +++++++++++++++ cli/tsc/dts/lib.deno.unstable.d.ts | 804 ------------------ cli/tsc/dts/lib.deno_webgpu.d.ts | 691 +++------------ tests/integration/lsp_tests.rs | 20 +- .../specs/check/unstable_suggestion/main.out | 11 +- tests/specs/check/unstable_suggestion/main.ts | 5 +- tools/jsdoc_checker.js | 2 +- 7 files changed, 847 insertions(+), 1375 deletions(-) diff --git a/cli/tsc/dts/lib.deno.ns.d.ts b/cli/tsc/dts/lib.deno.ns.d.ts index adda5791b9..1cf6667b1d 100644 --- a/cli/tsc/dts/lib.deno.ns.d.ts +++ b/cli/tsc/dts/lib.deno.ns.d.ts @@ -4556,6 +4556,24 @@ declare namespace Deno { mtime: number | Date, ): Promise; + /** Retrieve the process umask. If `mask` is provided, sets the process umask. + * This call always returns what the umask was before the call. + * + * ```ts + * console.log(Deno.umask()); // e.g. 18 (0o022) + * const prevUmaskValue = Deno.umask(0o077); // e.g. 18 (0o022) + * console.log(Deno.umask()); // e.g. 63 (0o077) + * ``` + * + * This API is under consideration to determine if permissions are required to + * call it. + * + * *Note*: This API is not implemented on Windows + * + * @category File System + */ + export function umask(mask?: number): number; + /** The object that is returned from a {@linkcode Deno.upgradeWebSocket} * request. * @@ -5395,4 +5413,675 @@ declare namespace Deno { & (ServeTcpOptions | (ServeTcpOptions & TlsCertifiedKeyOptions)) & ServeInit, ): HttpServer; + + /** All plain number types for interfacing with foreign functions. + * + * @category FFI + */ + export type NativeNumberType = + | "u8" + | "i8" + | "u16" + | "i16" + | "u32" + | "i32" + | "f32" + | "f64"; + + /** All BigInt number types for interfacing with foreign functions. + * + * @category FFI + */ + export type NativeBigIntType = + | "u64" + | "i64" + | "usize" + | "isize"; + + /** The native boolean type for interfacing to foreign functions. + * + * @category FFI + */ + export type NativeBooleanType = "bool"; + + /** The native pointer type for interfacing to foreign functions. + * + * @category FFI + */ + export type NativePointerType = "pointer"; + + /** The native buffer type for interfacing to foreign functions. + * + * @category FFI + */ + export type NativeBufferType = "buffer"; + + /** The native function type for interfacing with foreign functions. + * + * @category FFI + */ + export type NativeFunctionType = "function"; + + /** The native void type for interfacing with foreign functions. + * + * @category FFI + */ + export type NativeVoidType = "void"; + + /** The native struct type for interfacing with foreign functions. + * + * @category FFI + */ + export type NativeStructType = { readonly struct: readonly NativeType[] }; + + /** + * @category FFI + */ + export const brand: unique symbol; + + /** + * @category FFI + */ + export type NativeU8Enum = "u8" & { [brand]: T }; + /** + * @category FFI + */ + export type NativeI8Enum = "i8" & { [brand]: T }; + /** + * @category FFI + */ + export type NativeU16Enum = "u16" & { [brand]: T }; + /** + * @category FFI + */ + export type NativeI16Enum = "i16" & { [brand]: T }; + /** + * @category FFI + */ + export type NativeU32Enum = "u32" & { [brand]: T }; + /** + * @category FFI + */ + export type NativeI32Enum = "i32" & { [brand]: T }; + /** + * @category FFI + */ + export type NativeTypedPointer = "pointer" & { + [brand]: T; + }; + /** + * @category FFI + */ + export type NativeTypedFunction = + & "function" + & { + [brand]: T; + }; + + /** All supported types for interfacing with foreign functions. + * + * @category FFI + */ + export type NativeType = + | NativeNumberType + | NativeBigIntType + | NativeBooleanType + | NativePointerType + | NativeBufferType + | NativeFunctionType + | NativeStructType; + + /** @category FFI + */ + export type NativeResultType = NativeType | NativeVoidType; + + /** Type conversion for foreign symbol parameters and unsafe callback return + * types. + * + * @category FFI + */ + export type ToNativeType = T extends + NativeStructType ? BufferSource + : T extends NativeNumberType ? T extends NativeU8Enum ? U + : T extends NativeI8Enum ? U + : T extends NativeU16Enum ? U + : T extends NativeI16Enum ? U + : T extends NativeU32Enum ? U + : T extends NativeI32Enum ? U + : number + : T extends NativeBigIntType ? bigint + : T extends NativeBooleanType ? boolean + : T extends NativePointerType + ? T extends NativeTypedPointer ? U | null : PointerValue + : T extends NativeFunctionType + ? T extends NativeTypedFunction ? PointerValue | null + : PointerValue + : T extends NativeBufferType ? BufferSource | null + : never; + + /** Type conversion for unsafe callback return types. + * + * @category FFI + */ + export type ToNativeResultType< + T extends NativeResultType = NativeResultType, + > = T extends NativeStructType ? BufferSource + : T extends NativeNumberType ? T extends NativeU8Enum ? U + : T extends NativeI8Enum ? U + : T extends NativeU16Enum ? U + : T extends NativeI16Enum ? U + : T extends NativeU32Enum ? U + : T extends NativeI32Enum ? U + : number + : T extends NativeBigIntType ? bigint + : T extends NativeBooleanType ? boolean + : T extends NativePointerType + ? T extends NativeTypedPointer ? U | null : PointerValue + : T extends NativeFunctionType + ? T extends NativeTypedFunction ? PointerObject | null + : PointerValue + : T extends NativeBufferType ? BufferSource | null + : T extends NativeVoidType ? void + : never; + + /** A utility type for conversion of parameter types of foreign functions. + * + * @category FFI + */ + export type ToNativeParameterTypes = + // + [(T[number])[]] extends [T] ? ToNativeType[] + : [readonly (T[number])[]] extends [T] + ? readonly ToNativeType[] + : T extends readonly [...NativeType[]] ? { + [K in keyof T]: ToNativeType; + } + : never; + + /** Type conversion for foreign symbol return types and unsafe callback + * parameters. + * + * @category FFI + */ + export type FromNativeType = T extends + NativeStructType ? Uint8Array + : T extends NativeNumberType ? T extends NativeU8Enum ? U + : T extends NativeI8Enum ? U + : T extends NativeU16Enum ? U + : T extends NativeI16Enum ? U + : T extends NativeU32Enum ? U + : T extends NativeI32Enum ? U + : number + : T extends NativeBigIntType ? bigint + : T extends NativeBooleanType ? boolean + : T extends NativePointerType + ? T extends NativeTypedPointer ? U | null : PointerValue + : T extends NativeBufferType ? PointerValue + : T extends NativeFunctionType + ? T extends NativeTypedFunction ? PointerObject | null + : PointerValue + : never; + + /** Type conversion for foreign symbol return types. + * + * @category FFI + */ + export type FromNativeResultType< + T extends NativeResultType = NativeResultType, + > = T extends NativeStructType ? Uint8Array + : T extends NativeNumberType ? T extends NativeU8Enum ? U + : T extends NativeI8Enum ? U + : T extends NativeU16Enum ? U + : T extends NativeI16Enum ? U + : T extends NativeU32Enum ? U + : T extends NativeI32Enum ? U + : number + : T extends NativeBigIntType ? bigint + : T extends NativeBooleanType ? boolean + : T extends NativePointerType + ? T extends NativeTypedPointer ? U | null : PointerValue + : T extends NativeBufferType ? PointerValue + : T extends NativeFunctionType + ? T extends NativeTypedFunction ? PointerObject | null + : PointerValue + : T extends NativeVoidType ? void + : never; + + /** @category FFI + */ + export type FromNativeParameterTypes< + T extends readonly NativeType[], + > = + // + [(T[number])[]] extends [T] ? FromNativeType[] + : [readonly (T[number])[]] extends [T] + ? readonly FromNativeType[] + : T extends readonly [...NativeType[]] ? { + [K in keyof T]: FromNativeType; + } + : never; + + /** The interface for a foreign function as defined by its parameter and result + * types. + * + * @category FFI + */ + export interface ForeignFunction< + Parameters extends readonly NativeType[] = readonly NativeType[], + Result extends NativeResultType = NativeResultType, + NonBlocking extends boolean = boolean, + > { + /** Name of the symbol. + * + * Defaults to the key name in symbols object. */ + name?: string; + /** The parameters of the foreign function. */ + parameters: Parameters; + /** The result (return value) of the foreign function. */ + result: Result; + /** When `true`, function calls will run on a dedicated blocking thread and + * will return a `Promise` resolving to the `result`. */ + nonblocking?: NonBlocking; + /** When `true`, dlopen will not fail if the symbol is not found. + * Instead, the symbol will be set to `null`. + * + * @default {false} */ + optional?: boolean; + } + + /** @category FFI + */ + export interface ForeignStatic { + /** Name of the symbol, defaults to the key name in symbols object. */ + 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; + } + + /** A foreign library interface descriptor. + * + * @category FFI + */ + export interface ForeignLibraryInterface { + [name: string]: ForeignFunction | ForeignStatic; + } + + /** A utility type that infers a foreign symbol. + * + * @category FFI + */ + export type StaticForeignSymbol = + T extends ForeignFunction ? FromForeignFunction + : T extends ForeignStatic ? FromNativeType + : never; + + /** @category FFI + */ + export type FromForeignFunction = + T["parameters"] extends readonly [] ? () => StaticForeignSymbolReturnType + : ( + ...args: ToNativeParameterTypes + ) => StaticForeignSymbolReturnType; + + /** @category FFI + */ + export type StaticForeignSymbolReturnType = + ConditionalAsync>; + + /** @category FFI + */ + export type ConditionalAsync = + IsAsync extends true ? Promise : T; + + /** A utility type that infers a foreign library interface. + * + * @category FFI + */ + export type StaticForeignLibraryInterface = + { + [K in keyof T]: T[K]["optional"] extends true + ? StaticForeignSymbol | null + : StaticForeignSymbol; + }; + + /** A non-null pointer, represented as an object + * at runtime. The object's prototype is `null` + * and cannot be changed. The object cannot be + * assigned to either and is thus entirely read-only. + * + * To interact with memory through a pointer use the + * {@linkcode UnsafePointerView} class. To create a + * pointer from an address or the get the address of + * a pointer use the static methods of the + * {@linkcode UnsafePointer} class. + * + * @category FFI + */ + export type PointerObject = { [brand]: T }; + + /** Pointers are represented either with a {@linkcode PointerObject} + * object or a `null` if the pointer is null. + * + * @category FFI + */ + export type PointerValue = null | PointerObject; + + /** A collection of static functions for interacting with pointer objects. + * + * @category FFI + */ + export class UnsafePointer { + /** Create a pointer from a numeric value. This one is really dangerous! */ + static create(value: bigint): PointerValue; + /** Returns `true` if the two pointers point to the same address. */ + static equals(a: PointerValue, b: PointerValue): boolean; + /** Return the direct memory pointer to the typed array in memory. */ + static of( + value: Deno.UnsafeCallback | BufferSource, + ): PointerValue; + /** Return a new pointer offset from the original by `offset` bytes. */ + static offset( + value: PointerObject, + offset: number, + ): PointerValue; + /** Get the numeric value of a pointer */ + static value(value: PointerValue): bigint; + } + + /** An unsafe pointer view to a memory location as specified by the `pointer` + * value. The `UnsafePointerView` API follows the standard built in interface + * {@linkcode DataView} for accessing the underlying types at an memory + * location (numbers, strings and raw bytes). + * + * @category FFI + */ + export class UnsafePointerView { + constructor(pointer: PointerObject); + + pointer: PointerObject; + + /** Gets a boolean at the specified byte offset from the pointer. */ + getBool(offset?: number): boolean; + /** Gets an unsigned 8-bit integer at the specified byte offset from the + * pointer. */ + getUint8(offset?: number): number; + /** Gets a signed 8-bit integer at the specified byte offset from the + * pointer. */ + getInt8(offset?: number): number; + /** Gets an unsigned 16-bit integer at the specified byte offset from the + * pointer. */ + getUint16(offset?: number): number; + /** Gets a signed 16-bit integer at the specified byte offset from the + * pointer. */ + getInt16(offset?: number): number; + /** Gets an unsigned 32-bit integer at the specified byte offset from the + * pointer. */ + getUint32(offset?: number): number; + /** Gets a signed 32-bit integer at the specified byte offset from the + * pointer. */ + getInt32(offset?: number): number; + /** Gets an unsigned 64-bit integer at the specified byte offset from the + * pointer. */ + getBigUint64(offset?: number): bigint; + /** Gets a signed 64-bit integer at the specified byte offset from the + * pointer. */ + getBigInt64(offset?: number): bigint; + /** Gets a signed 32-bit float at the specified byte offset from the + * pointer. */ + getFloat32(offset?: number): number; + /** Gets a signed 64-bit float at the specified byte offset from the + * pointer. */ + getFloat64(offset?: number): number; + /** Gets a pointer at the specified byte offset from the pointer */ + getPointer(offset?: number): PointerValue; + /** Gets a C string (`null` terminated string) at the specified byte offset + * from the pointer. */ + getCString(offset?: number): string; + /** Gets a C string (`null` terminated string) at the specified byte offset + * from the specified pointer. */ + static getCString( + pointer: PointerObject, + offset?: number, + ): string; + /** Gets an `ArrayBuffer` of length `byteLength` at the specified byte + * offset from the pointer. */ + getArrayBuffer(byteLength: number, offset?: number): ArrayBuffer; + /** Gets an `ArrayBuffer` of length `byteLength` at the specified byte + * offset from the specified pointer. */ + static getArrayBuffer( + pointer: PointerObject, + byteLength: number, + offset?: number, + ): ArrayBuffer; + /** Copies the memory of the pointer into a typed array. + * + * Length is determined from the typed array's `byteLength`. + * + * Also takes optional byte offset from the pointer. */ + copyInto(destination: BufferSource, offset?: number): void; + /** Copies the memory of the specified pointer into a typed array. + * + * Length is determined from the typed array's `byteLength`. + * + * Also takes optional byte offset from the pointer. */ + static copyInto( + pointer: PointerObject, + destination: BufferSource, + offset?: number, + ): void; + } + + /** An unsafe pointer to a function, for calling functions that are not present + * as symbols. + * + * @category FFI + */ + export class UnsafeFnPointer { + /** The pointer to the function. */ + pointer: PointerObject; + /** The definition of the function. */ + definition: Fn; + + constructor(pointer: PointerObject>, definition: Fn); + /** @deprecated Properly type {@linkcode pointer} using {@linkcode NativeTypedFunction} or {@linkcode UnsafeCallbackDefinition} types. */ + constructor(pointer: PointerObject, definition: Fn); + + /** Call the foreign function. */ + call: FromForeignFunction; + } + + /** Definition of a unsafe callback function. + * + * @category FFI + */ + export interface UnsafeCallbackDefinition< + Parameters extends readonly NativeType[] = readonly NativeType[], + Result extends NativeResultType = NativeResultType, + > { + /** The parameters of the callbacks. */ + parameters: Parameters; + /** The current result of the callback. */ + result: Result; + } + + /** An unsafe callback function. + * + * @category FFI + */ + export type UnsafeCallbackFunction< + Parameters extends readonly NativeType[] = readonly NativeType[], + Result extends NativeResultType = NativeResultType, + > = Parameters extends readonly [] ? () => ToNativeResultType : ( + ...args: FromNativeParameterTypes + ) => ToNativeResultType; + + /** An unsafe function pointer for passing JavaScript functions as C function + * pointers to foreign function calls. + * + * The function pointer remains valid until the `close()` method is called. + * + * All `UnsafeCallback` are always thread safe in that they can be called from + * foreign threads without crashing. However, they do not wake up the Deno event + * loop by default. + * + * If a callback is to be called from foreign threads, use the `threadSafe()` + * static constructor or explicitly call `ref()` to have the callback wake up + * the Deno event loop when called from foreign threads. This also stops + * Deno's process from exiting while the callback still exists and is not + * unref'ed. + * + * Use `deref()` to then allow Deno's process to exit. Calling `deref()` on + * a ref'ed callback does not stop it from waking up the Deno event loop when + * called from foreign threads. + * + * @category FFI + */ + export class UnsafeCallback< + const Definition extends UnsafeCallbackDefinition = + UnsafeCallbackDefinition, + > { + constructor( + definition: Definition, + callback: UnsafeCallbackFunction< + Definition["parameters"], + Definition["result"] + >, + ); + + /** The pointer to the unsafe callback. */ + readonly pointer: PointerObject; + /** The definition of the unsafe callback. */ + readonly definition: Definition; + /** The callback function. */ + readonly callback: UnsafeCallbackFunction< + Definition["parameters"], + Definition["result"] + >; + + /** + * Creates an {@linkcode UnsafeCallback} and calls `ref()` once to allow it to + * wake up the Deno event loop when called from foreign threads. + * + * This also stops Deno's process from exiting while the callback still + * exists and is not unref'ed. + */ + static threadSafe< + Definition extends UnsafeCallbackDefinition = UnsafeCallbackDefinition, + >( + definition: Definition, + callback: UnsafeCallbackFunction< + Definition["parameters"], + Definition["result"] + >, + ): UnsafeCallback; + + /** + * Increments the callback's reference counting and returns the new + * reference count. + * + * After `ref()` has been called, the callback always wakes up the + * Deno event loop when called from foreign threads. + * + * If the callback's reference count is non-zero, it keeps Deno's + * process from exiting. + */ + ref(): number; + + /** + * Decrements the callback's reference counting and returns the new + * reference count. + * + * Calling `unref()` does not stop a callback from waking up the Deno + * event loop when called from foreign threads. + * + * If the callback's reference counter is zero, it no longer keeps + * Deno's process from exiting. + */ + unref(): number; + + /** + * Removes the C function pointer associated with this instance. + * + * Continuing to use the instance or the C function pointer after closing + * the `UnsafeCallback` will lead to errors and crashes. + * + * Calling this method sets the callback's reference counting to zero, + * stops the callback from waking up the Deno event loop when called from + * foreign threads and no longer keeps Deno's process from exiting. + */ + close(): void; + } + + /** A dynamic library resource. Use {@linkcode Deno.dlopen} to load a dynamic + * library and return this interface. + * + * @category FFI + */ + export interface DynamicLibrary { + /** All of the registered library along with functions for calling them. */ + symbols: StaticForeignLibraryInterface; + /** Removes the pointers associated with the library symbols. + * + * Continuing to use symbols that are part of the library will lead to + * errors and crashes. + * + * Calling this method will also immediately set any references to zero and + * will no longer keep Deno's process from exiting. + */ + close(): void; + } + + /** Opens an external dynamic library and registers symbols, making foreign + * functions available to be called. + * + * Requires `allow-ffi` permission. Loading foreign dynamic libraries can in + * theory bypass all of the sandbox permissions. While it is a separate + * permission users should acknowledge in practice that is effectively the + * same as running with the `allow-all` permission. + * + * @example Given a C library which exports a foreign function named `add()` + * + * ```ts + * // Determine library extension based on + * // your OS. + * let libSuffix = ""; + * switch (Deno.build.os) { + * case "windows": + * libSuffix = "dll"; + * break; + * case "darwin": + * libSuffix = "dylib"; + * break; + * default: + * libSuffix = "so"; + * break; + * } + * + * const libName = `./libadd.${libSuffix}`; + * // Open library and define exported symbols + * const dylib = Deno.dlopen( + * libName, + * { + * "add": { parameters: ["isize", "isize"], result: "isize" }, + * } as const, + * ); + * + * // Call the symbol `add` + * const result = dylib.symbols.add(35n, 34n); // 69n + * + * console.log(`Result from external addition of 35 and 34: ${result}`); + * ``` + * + * @tags allow-ffi + * @category FFI + */ + export function dlopen( + filename: string | URL, + symbols: S, + ): DynamicLibrary; } diff --git a/cli/tsc/dts/lib.deno.unstable.d.ts b/cli/tsc/dts/lib.deno.unstable.d.ts index 7185b8b5af..b826aa1f7f 100644 --- a/cli/tsc/dts/lib.deno.unstable.d.ts +++ b/cli/tsc/dts/lib.deno.unstable.d.ts @@ -3,816 +3,12 @@ /// /// /// -/// /// /// declare namespace Deno { export {}; // stop default export type behavior - /** **UNSTABLE**: New API, yet to be vetted. - * - * Retrieve the process umask. If `mask` is provided, sets the process umask. - * This call always returns what the umask was before the call. - * - * ```ts - * console.log(Deno.umask()); // e.g. 18 (0o022) - * const prevUmaskValue = Deno.umask(0o077); // e.g. 18 (0o022) - * console.log(Deno.umask()); // e.g. 63 (0o077) - * ``` - * - * This API is under consideration to determine if permissions are required to - * call it. - * - * *Note*: This API is not implemented on Windows - * - * @category File System - * @experimental - */ - export function umask(mask?: number): number; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * All plain number types for interfacing with foreign functions. - * - * @category FFI - * @experimental - */ - export type NativeNumberType = - | "u8" - | "i8" - | "u16" - | "i16" - | "u32" - | "i32" - | "f32" - | "f64"; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * All BigInt number types for interfacing with foreign functions. - * - * @category FFI - * @experimental - */ - export type NativeBigIntType = - | "u64" - | "i64" - | "usize" - | "isize"; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * The native boolean type for interfacing to foreign functions. - * - * @category FFI - * @experimental - */ - export type NativeBooleanType = "bool"; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * The native pointer type for interfacing to foreign functions. - * - * @category FFI - * @experimental - */ - export type NativePointerType = "pointer"; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * The native buffer type for interfacing to foreign functions. - * - * @category FFI - * @experimental - */ - export type NativeBufferType = "buffer"; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * The native function type for interfacing with foreign functions. - * - * @category FFI - * @experimental - */ - export type NativeFunctionType = "function"; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * The native void type for interfacing with foreign functions. - * - * @category FFI - * @experimental - */ - export type NativeVoidType = "void"; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * The native struct type for interfacing with foreign functions. - * - * @category FFI - * @experimental - */ - export type NativeStructType = { readonly struct: readonly NativeType[] }; - - /** - * @category FFI - * @experimental - */ - export const brand: unique symbol; - - /** - * @category FFI - * @experimental - */ - export type NativeU8Enum = "u8" & { [brand]: T }; - /** - * @category FFI - * @experimental - */ - export type NativeI8Enum = "i8" & { [brand]: T }; - /** - * @category FFI - * @experimental - */ - export type NativeU16Enum = "u16" & { [brand]: T }; - /** - * @category FFI - * @experimental - */ - export type NativeI16Enum = "i16" & { [brand]: T }; - /** - * @category FFI - * @experimental - */ - export type NativeU32Enum = "u32" & { [brand]: T }; - /** - * @category FFI - * @experimental - */ - export type NativeI32Enum = "i32" & { [brand]: T }; - /** - * @category FFI - * @experimental - */ - export type NativeTypedPointer = "pointer" & { - [brand]: T; - }; - /** - * @category FFI - * @experimental - */ - export type NativeTypedFunction = - & "function" - & { - [brand]: T; - }; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * All supported types for interfacing with foreign functions. - * - * @category FFI - * @experimental - */ - export type NativeType = - | NativeNumberType - | NativeBigIntType - | NativeBooleanType - | NativePointerType - | NativeBufferType - | NativeFunctionType - | NativeStructType; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * @category FFI - * @experimental - */ - export type NativeResultType = NativeType | NativeVoidType; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * Type conversion for foreign symbol parameters and unsafe callback return - * types. - * - * @category FFI - * @experimental - */ - export type ToNativeType = T extends - NativeStructType ? BufferSource - : T extends NativeNumberType ? T extends NativeU8Enum ? U - : T extends NativeI8Enum ? U - : T extends NativeU16Enum ? U - : T extends NativeI16Enum ? U - : T extends NativeU32Enum ? U - : T extends NativeI32Enum ? U - : number - : T extends NativeBigIntType ? bigint - : T extends NativeBooleanType ? boolean - : T extends NativePointerType - ? T extends NativeTypedPointer ? U | null : PointerValue - : T extends NativeFunctionType - ? T extends NativeTypedFunction ? PointerValue | null - : PointerValue - : T extends NativeBufferType ? BufferSource | null - : never; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * Type conversion for unsafe callback return types. - * - * @category FFI - * @experimental - */ - export type ToNativeResultType< - T extends NativeResultType = NativeResultType, - > = T extends NativeStructType ? BufferSource - : T extends NativeNumberType ? T extends NativeU8Enum ? U - : T extends NativeI8Enum ? U - : T extends NativeU16Enum ? U - : T extends NativeI16Enum ? U - : T extends NativeU32Enum ? U - : T extends NativeI32Enum ? U - : number - : T extends NativeBigIntType ? bigint - : T extends NativeBooleanType ? boolean - : T extends NativePointerType - ? T extends NativeTypedPointer ? U | null : PointerValue - : T extends NativeFunctionType - ? T extends NativeTypedFunction ? PointerObject | null - : PointerValue - : T extends NativeBufferType ? BufferSource | null - : T extends NativeVoidType ? void - : never; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * A utility type for conversion of parameter types of foreign functions. - * - * @category FFI - * @experimental - */ - export type ToNativeParameterTypes = - // - [(T[number])[]] extends [T] ? ToNativeType[] - : [readonly (T[number])[]] extends [T] - ? readonly ToNativeType[] - : T extends readonly [...NativeType[]] ? { - [K in keyof T]: ToNativeType; - } - : never; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * Type conversion for foreign symbol return types and unsafe callback - * parameters. - * - * @category FFI - * @experimental - */ - export type FromNativeType = T extends - NativeStructType ? Uint8Array - : T extends NativeNumberType ? T extends NativeU8Enum ? U - : T extends NativeI8Enum ? U - : T extends NativeU16Enum ? U - : T extends NativeI16Enum ? U - : T extends NativeU32Enum ? U - : T extends NativeI32Enum ? U - : number - : T extends NativeBigIntType ? bigint - : T extends NativeBooleanType ? boolean - : T extends NativePointerType - ? T extends NativeTypedPointer ? U | null : PointerValue - : T extends NativeBufferType ? PointerValue - : T extends NativeFunctionType - ? T extends NativeTypedFunction ? PointerObject | null - : PointerValue - : never; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * Type conversion for foreign symbol return types. - * - * @category FFI - * @experimental - */ - export type FromNativeResultType< - T extends NativeResultType = NativeResultType, - > = T extends NativeStructType ? Uint8Array - : T extends NativeNumberType ? T extends NativeU8Enum ? U - : T extends NativeI8Enum ? U - : T extends NativeU16Enum ? U - : T extends NativeI16Enum ? U - : T extends NativeU32Enum ? U - : T extends NativeI32Enum ? U - : number - : T extends NativeBigIntType ? bigint - : T extends NativeBooleanType ? boolean - : T extends NativePointerType - ? T extends NativeTypedPointer ? U | null : PointerValue - : T extends NativeBufferType ? PointerValue - : T extends NativeFunctionType - ? T extends NativeTypedFunction ? PointerObject | null - : PointerValue - : T extends NativeVoidType ? void - : never; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * @category FFI - * @experimental - */ - export type FromNativeParameterTypes< - T extends readonly NativeType[], - > = - // - [(T[number])[]] extends [T] ? FromNativeType[] - : [readonly (T[number])[]] extends [T] - ? readonly FromNativeType[] - : T extends readonly [...NativeType[]] ? { - [K in keyof T]: FromNativeType; - } - : never; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * The interface for a foreign function as defined by its parameter and result - * types. - * - * @category FFI - * @experimental - */ - export interface ForeignFunction< - Parameters extends readonly NativeType[] = readonly NativeType[], - Result extends NativeResultType = NativeResultType, - NonBlocking extends boolean = boolean, - > { - /** Name of the symbol. - * - * Defaults to the key name in symbols object. */ - name?: string; - /** The parameters of the foreign function. */ - parameters: Parameters; - /** The result (return value) of the foreign function. */ - result: Result; - /** When `true`, function calls will run on a dedicated blocking thread and - * will return a `Promise` resolving to the `result`. */ - nonblocking?: NonBlocking; - /** 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. - * - * @category FFI - * @experimental - */ - export interface ForeignStatic { - /** Name of the symbol, defaults to the key name in symbols object. */ - 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. - * - * A foreign library interface descriptor. - * - * @category FFI - * @experimental - */ - export interface ForeignLibraryInterface { - [name: string]: ForeignFunction | ForeignStatic; - } - - /** **UNSTABLE**: New API, yet to be vetted. - * - * A utility type that infers a foreign symbol. - * - * @category FFI - * @experimental - */ - export type StaticForeignSymbol = - T extends ForeignFunction ? FromForeignFunction - : T extends ForeignStatic ? FromNativeType - : never; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * @category FFI - * @experimental - */ - export type FromForeignFunction = - T["parameters"] extends readonly [] ? () => StaticForeignSymbolReturnType - : ( - ...args: ToNativeParameterTypes - ) => StaticForeignSymbolReturnType; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * @category FFI - * @experimental - */ - export type StaticForeignSymbolReturnType = - ConditionalAsync>; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * @category FFI - * @experimental - */ - export type ConditionalAsync = - IsAsync extends true ? Promise : T; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * A utility type that infers a foreign library interface. - * - * @category FFI - * @experimental - */ - export type StaticForeignLibraryInterface = - { - [K in keyof T]: T[K]["optional"] extends true - ? StaticForeignSymbol | null - : StaticForeignSymbol; - }; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * A non-null pointer, represented as an object - * at runtime. The object's prototype is `null` - * and cannot be changed. The object cannot be - * assigned to either and is thus entirely read-only. - * - * To interact with memory through a pointer use the - * {@linkcode UnsafePointerView} class. To create a - * pointer from an address or the get the address of - * a pointer use the static methods of the - * {@linkcode UnsafePointer} class. - * - * @category FFI - * @experimental - */ - export type PointerObject = { [brand]: T }; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * Pointers are represented either with a {@linkcode PointerObject} - * object or a `null` if the pointer is null. - * - * @category FFI - * @experimental - */ - export type PointerValue = null | PointerObject; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * A collection of static functions for interacting with pointer objects. - * - * @category FFI - * @experimental - */ - export class UnsafePointer { - /** Create a pointer from a numeric value. This one is really dangerous! */ - static create(value: bigint): PointerValue; - /** Returns `true` if the two pointers point to the same address. */ - static equals(a: PointerValue, b: PointerValue): boolean; - /** Return the direct memory pointer to the typed array in memory. */ - static of( - value: Deno.UnsafeCallback | BufferSource, - ): PointerValue; - /** Return a new pointer offset from the original by `offset` bytes. */ - static offset( - value: PointerObject, - offset: number, - ): PointerValue; - /** Get the numeric value of a pointer */ - static value(value: PointerValue): bigint; - } - - /** **UNSTABLE**: New API, yet to be vetted. - * - * An unsafe pointer view to a memory location as specified by the `pointer` - * value. The `UnsafePointerView` API follows the standard built in interface - * {@linkcode DataView} for accessing the underlying types at an memory - * location (numbers, strings and raw bytes). - * - * @category FFI - * @experimental - */ - export class UnsafePointerView { - constructor(pointer: PointerObject); - - pointer: PointerObject; - - /** Gets a boolean at the specified byte offset from the pointer. */ - getBool(offset?: number): boolean; - /** Gets an unsigned 8-bit integer at the specified byte offset from the - * pointer. */ - getUint8(offset?: number): number; - /** Gets a signed 8-bit integer at the specified byte offset from the - * pointer. */ - getInt8(offset?: number): number; - /** Gets an unsigned 16-bit integer at the specified byte offset from the - * pointer. */ - getUint16(offset?: number): number; - /** Gets a signed 16-bit integer at the specified byte offset from the - * pointer. */ - getInt16(offset?: number): number; - /** Gets an unsigned 32-bit integer at the specified byte offset from the - * pointer. */ - getUint32(offset?: number): number; - /** Gets a signed 32-bit integer at the specified byte offset from the - * pointer. */ - getInt32(offset?: number): number; - /** Gets an unsigned 64-bit integer at the specified byte offset from the - * pointer. */ - getBigUint64(offset?: number): bigint; - /** Gets a signed 64-bit integer at the specified byte offset from the - * pointer. */ - getBigInt64(offset?: number): bigint; - /** Gets a signed 32-bit float at the specified byte offset from the - * pointer. */ - getFloat32(offset?: number): number; - /** Gets a signed 64-bit float at the specified byte offset from the - * pointer. */ - getFloat64(offset?: number): number; - /** Gets a pointer at the specified byte offset from the pointer */ - getPointer(offset?: number): PointerValue; - /** Gets a C string (`null` terminated string) at the specified byte offset - * from the pointer. */ - getCString(offset?: number): string; - /** Gets a C string (`null` terminated string) at the specified byte offset - * from the specified pointer. */ - static getCString( - pointer: PointerObject, - offset?: number, - ): string; - /** Gets an `ArrayBuffer` of length `byteLength` at the specified byte - * offset from the pointer. */ - getArrayBuffer(byteLength: number, offset?: number): ArrayBuffer; - /** Gets an `ArrayBuffer` of length `byteLength` at the specified byte - * offset from the specified pointer. */ - static getArrayBuffer( - pointer: PointerObject, - byteLength: number, - offset?: number, - ): ArrayBuffer; - /** Copies the memory of the pointer into a typed array. - * - * Length is determined from the typed array's `byteLength`. - * - * Also takes optional byte offset from the pointer. */ - copyInto(destination: BufferSource, offset?: number): void; - /** Copies the memory of the specified pointer into a typed array. - * - * Length is determined from the typed array's `byteLength`. - * - * Also takes optional byte offset from the pointer. */ - static copyInto( - pointer: PointerObject, - destination: BufferSource, - offset?: number, - ): void; - } - - /** **UNSTABLE**: New API, yet to be vetted. - * - * An unsafe pointer to a function, for calling functions that are not present - * as symbols. - * - * @category FFI - * @experimental - */ - export class UnsafeFnPointer { - /** The pointer to the function. */ - pointer: PointerObject; - /** The definition of the function. */ - definition: Fn; - - constructor(pointer: PointerObject>, definition: Fn); - /** @deprecated Properly type {@linkcode pointer} using {@linkcode NativeTypedFunction} or {@linkcode UnsafeCallbackDefinition} types. */ - constructor(pointer: PointerObject, definition: Fn); - - /** Call the foreign function. */ - call: FromForeignFunction; - } - - /** **UNSTABLE**: New API, yet to be vetted. - * - * Definition of a unsafe callback function. - * - * @category FFI - * @experimental - */ - export interface UnsafeCallbackDefinition< - Parameters extends readonly NativeType[] = readonly NativeType[], - Result extends NativeResultType = NativeResultType, - > { - /** The parameters of the callbacks. */ - parameters: Parameters; - /** The current result of the callback. */ - result: Result; - } - - /** **UNSTABLE**: New API, yet to be vetted. - * - * An unsafe callback function. - * - * @category FFI - * @experimental - */ - export type UnsafeCallbackFunction< - Parameters extends readonly NativeType[] = readonly NativeType[], - Result extends NativeResultType = NativeResultType, - > = Parameters extends readonly [] ? () => ToNativeResultType : ( - ...args: FromNativeParameterTypes - ) => ToNativeResultType; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * An unsafe function pointer for passing JavaScript functions as C function - * pointers to foreign function calls. - * - * The function pointer remains valid until the `close()` method is called. - * - * All `UnsafeCallback` are always thread safe in that they can be called from - * foreign threads without crashing. However, they do not wake up the Deno event - * loop by default. - * - * If a callback is to be called from foreign threads, use the `threadSafe()` - * static constructor or explicitly call `ref()` to have the callback wake up - * the Deno event loop when called from foreign threads. This also stops - * Deno's process from exiting while the callback still exists and is not - * unref'ed. - * - * Use `deref()` to then allow Deno's process to exit. Calling `deref()` on - * a ref'ed callback does not stop it from waking up the Deno event loop when - * called from foreign threads. - * - * @category FFI - * @experimental - */ - export class UnsafeCallback< - const Definition extends UnsafeCallbackDefinition = - UnsafeCallbackDefinition, - > { - constructor( - definition: Definition, - callback: UnsafeCallbackFunction< - Definition["parameters"], - Definition["result"] - >, - ); - - /** The pointer to the unsafe callback. */ - readonly pointer: PointerObject; - /** The definition of the unsafe callback. */ - readonly definition: Definition; - /** The callback function. */ - readonly callback: UnsafeCallbackFunction< - Definition["parameters"], - Definition["result"] - >; - - /** - * Creates an {@linkcode UnsafeCallback} and calls `ref()` once to allow it to - * wake up the Deno event loop when called from foreign threads. - * - * This also stops Deno's process from exiting while the callback still - * exists and is not unref'ed. - */ - static threadSafe< - Definition extends UnsafeCallbackDefinition = UnsafeCallbackDefinition, - >( - definition: Definition, - callback: UnsafeCallbackFunction< - Definition["parameters"], - Definition["result"] - >, - ): UnsafeCallback; - - /** - * Increments the callback's reference counting and returns the new - * reference count. - * - * After `ref()` has been called, the callback always wakes up the - * Deno event loop when called from foreign threads. - * - * If the callback's reference count is non-zero, it keeps Deno's - * process from exiting. - */ - ref(): number; - - /** - * Decrements the callback's reference counting and returns the new - * reference count. - * - * Calling `unref()` does not stop a callback from waking up the Deno - * event loop when called from foreign threads. - * - * If the callback's reference counter is zero, it no longer keeps - * Deno's process from exiting. - */ - unref(): number; - - /** - * Removes the C function pointer associated with this instance. - * - * Continuing to use the instance or the C function pointer after closing - * the `UnsafeCallback` will lead to errors and crashes. - * - * Calling this method sets the callback's reference counting to zero, - * stops the callback from waking up the Deno event loop when called from - * foreign threads and no longer keeps Deno's process from exiting. - */ - close(): void; - } - - /** **UNSTABLE**: New API, yet to be vetted. - * - * A dynamic library resource. Use {@linkcode Deno.dlopen} to load a dynamic - * library and return this interface. - * - * @category FFI - * @experimental - */ - export interface DynamicLibrary { - /** All of the registered library along with functions for calling them. */ - symbols: StaticForeignLibraryInterface; - /** Removes the pointers associated with the library symbols. - * - * Continuing to use symbols that are part of the library will lead to - * errors and crashes. - * - * Calling this method will also immediately set any references to zero and - * will no longer keep Deno's process from exiting. - */ - close(): void; - } - - /** **UNSTABLE**: New API, yet to be vetted. - * - * Opens an external dynamic library and registers symbols, making foreign - * functions available to be called. - * - * Requires `allow-ffi` permission. Loading foreign dynamic libraries can in - * theory bypass all of the sandbox permissions. While it is a separate - * permission users should acknowledge in practice that is effectively the - * same as running with the `allow-all` permission. - * - * @example Given a C library which exports a foreign function named `add()` - * - * ```ts - * // Determine library extension based on - * // your OS. - * let libSuffix = ""; - * switch (Deno.build.os) { - * case "windows": - * libSuffix = "dll"; - * break; - * case "darwin": - * libSuffix = "dylib"; - * break; - * default: - * libSuffix = "so"; - * break; - * } - * - * const libName = `./libadd.${libSuffix}`; - * // Open library and define exported symbols - * const dylib = Deno.dlopen( - * libName, - * { - * "add": { parameters: ["isize", "isize"], result: "isize" }, - * } as const, - * ); - * - * // Call the symbol `add` - * const result = dylib.symbols.add(35n, 34n); // 69n - * - * console.log(`Result from external addition of 35 and 34: ${result}`); - * ``` - * - * @tags allow-ffi - * @category FFI - * @experimental - */ - export function dlopen( - filename: string | URL, - symbols: S, - ): DynamicLibrary; - /** **UNSTABLE**: New API, yet to be vetted. * * Creates a presentable WebGPU surface from given window and diff --git a/cli/tsc/dts/lib.deno_webgpu.d.ts b/cli/tsc/dts/lib.deno_webgpu.d.ts index 944af0e4c5..fc2676b2e3 100644 --- a/cli/tsc/dts/lib.deno_webgpu.d.ts +++ b/cli/tsc/dts/lib.deno_webgpu.d.ts @@ -5,26 +5,17 @@ /// /// -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUObjectBase { label: string; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUObjectDescriptorBase { label?: string; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUSupportedLimits { maxTextureDimension1D?: number; maxTextureDimension2D?: number; @@ -58,10 +49,7 @@ declare class GPUSupportedLimits { maxComputeWorkgroupsPerDimension?: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUSupportedFeatures { forEach( callbackfn: ( @@ -79,10 +67,7 @@ declare class GPUSupportedFeatures { values(): IterableIterator; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUAdapterInfo { readonly vendor: string; readonly architecture: string; @@ -90,10 +75,7 @@ declare class GPUAdapterInfo { readonly description: string; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPU { requestAdapter( options?: GPURequestAdapterOptions, @@ -101,25 +83,16 @@ declare class GPU { getPreferredCanvasFormat(): GPUTextureFormat; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPURequestAdapterOptions { powerPreference?: GPUPowerPreference; forceFallbackAdapter?: boolean; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUPowerPreference = "low-power" | "high-performance"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUAdapter { readonly features: GPUSupportedFeatures; readonly limits: GPUSupportedLimits; @@ -129,19 +102,13 @@ declare class GPUAdapter { requestDevice(descriptor?: GPUDeviceDescriptor): Promise; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUDeviceDescriptor extends GPUObjectDescriptorBase { requiredFeatures?: GPUFeatureName[]; requiredLimits?: Record; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUFeatureName = | "depth-clip-control" | "depth32float-stencil8" @@ -169,10 +136,7 @@ declare type GPUFeatureName = | "shader-float64" | "vertex-attribute-64bit"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUDevice extends EventTarget implements GPUObjectBase { label: string; @@ -222,10 +186,7 @@ declare class GPUDevice extends EventTarget implements GPUObjectBase { createQuerySet(descriptor: GPUQuerySetDescriptor): GPUQuerySet; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUBuffer implements GPUObjectBase { label: string; @@ -244,38 +205,23 @@ declare class GPUBuffer implements GPUObjectBase { destroy(): undefined; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUBufferMapState = "unmapped" | "pending" | "mapped"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUBufferDescriptor extends GPUObjectDescriptorBase { size: number; usage: GPUBufferUsageFlags; mappedAtCreation?: boolean; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUBufferUsageFlags = number; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUFlagsConstant = number; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUBufferUsage { static MAP_READ: 0x0001; static MAP_WRITE: 0x0002; @@ -289,25 +235,16 @@ declare class GPUBufferUsage { static QUERY_RESOLVE: 0x0200; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUMapModeFlags = number; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUMapMode { static READ: 0x0001; static WRITE: 0x0002; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUTexture implements GPUObjectBase { label: string; @@ -324,10 +261,7 @@ declare class GPUTexture implements GPUObjectBase { readonly usage: GPUFlagsConstant; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUTextureDescriptor extends GPUObjectDescriptorBase { size: GPUExtent3D; mipLevelCount?: number; @@ -338,22 +272,13 @@ declare interface GPUTextureDescriptor extends GPUObjectDescriptorBase { viewFormats?: GPUTextureFormat[]; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUTextureDimension = "1d" | "2d" | "3d"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUTextureUsageFlags = number; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUTextureUsage { static COPY_SRC: 0x01; static COPY_DST: 0x02; @@ -362,18 +287,12 @@ declare class GPUTextureUsage { static RENDER_ATTACHMENT: 0x10; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUTextureView implements GPUObjectBase { label: string; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUTextureViewDescriptor extends GPUObjectDescriptorBase { format?: GPUTextureFormat; dimension?: GPUTextureViewDimension; @@ -384,10 +303,7 @@ declare interface GPUTextureViewDescriptor extends GPUObjectDescriptorBase { arrayLayerCount?: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUTextureViewDimension = | "1d" | "2d" @@ -396,16 +312,10 @@ declare type GPUTextureViewDimension = | "cube-array" | "3d"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUTextureAspect = "all" | "stencil-only" | "depth-only"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUTextureFormat = | "r8unorm" | "r8snorm" @@ -503,18 +413,12 @@ declare type GPUTextureFormat = | "astc-12x12-unorm" | "astc-12x12-unorm-srgb"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUSampler implements GPUObjectBase { label: string; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUSamplerDescriptor extends GPUObjectDescriptorBase { addressModeU?: GPUAddressMode; addressModeV?: GPUAddressMode; @@ -528,28 +432,16 @@ declare interface GPUSamplerDescriptor extends GPUObjectDescriptorBase { maxAnisotropy?: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUAddressMode = "clamp-to-edge" | "repeat" | "mirror-repeat"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUFilterMode = "nearest" | "linear"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUMipmapFilterMode = "nearest" | "linear"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUCompareFunction = | "never" | "less" @@ -560,26 +452,17 @@ declare type GPUCompareFunction = | "greater-equal" | "always"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUBindGroupLayout implements GPUObjectBase { label: string; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUBindGroupLayoutDescriptor extends GPUObjectDescriptorBase { entries: GPUBindGroupLayoutEntry[]; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUBindGroupLayoutEntry { binding: number; visibility: GPUShaderStageFlags; @@ -590,69 +473,45 @@ declare interface GPUBindGroupLayoutEntry { storageTexture?: GPUStorageTextureBindingLayout; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUShaderStageFlags = number; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUShaderStage { static VERTEX: 0x1; static FRAGMENT: 0x2; static COMPUTE: 0x4; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUBufferBindingLayout { type?: GPUBufferBindingType; hasDynamicOffset?: boolean; minBindingSize?: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUBufferBindingType = "uniform" | "storage" | "read-only-storage"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUSamplerBindingLayout { type?: GPUSamplerBindingType; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUSamplerBindingType = | "filtering" | "non-filtering" | "comparison"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUTextureBindingLayout { sampleType?: GPUTextureSampleType; viewDimension?: GPUTextureViewDimension; multisampled?: boolean; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUTextureSampleType = | "float" | "unfilterable-float" @@ -660,96 +519,63 @@ declare type GPUTextureSampleType = | "sint" | "uint"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUStorageTextureAccess = | "write-only" | "read-only" | "read-write"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUStorageTextureBindingLayout { access: GPUStorageTextureAccess; format: GPUTextureFormat; viewDimension?: GPUTextureViewDimension; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUBindGroup implements GPUObjectBase { label: string; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUBindGroupDescriptor extends GPUObjectDescriptorBase { layout: GPUBindGroupLayout; entries: GPUBindGroupEntry[]; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUBindingResource = | GPUSampler | GPUTextureView | GPUBufferBinding; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUBindGroupEntry { binding: number; resource: GPUBindingResource; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUBufferBinding { buffer: GPUBuffer; offset?: number; size?: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUPipelineLayout implements GPUObjectBase { label: string; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUPipelineLayoutDescriptor extends GPUObjectDescriptorBase { bindGroupLayouts: GPUBindGroupLayout[]; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUCompilationMessageType = "error" | "warning" | "info"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUCompilationMessage { readonly message: string; readonly type: GPUCompilationMessageType; @@ -757,120 +583,84 @@ declare interface GPUCompilationMessage { readonly linePos: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUCompilationInfo { readonly messages: ReadonlyArray; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUPipelineError extends DOMException { constructor(message?: string, options?: GPUPipelineErrorInit); readonly reason: GPUPipelineErrorReason; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUPipelineErrorInit { reason: GPUPipelineErrorReason; } /** * @category GPU - * @experimental + * @ */ declare type GPUPipelineErrorReason = "validation" | "internal"; /** * @category GPU - * @experimental + * @ */ declare class GPUShaderModule implements GPUObjectBase { label: string; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUShaderModuleDescriptor extends GPUObjectDescriptorBase { code: string; sourceMap?: any; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUAutoLayoutMode = "auto"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUPipelineDescriptorBase extends GPUObjectDescriptorBase { layout: GPUPipelineLayout | GPUAutoLayoutMode; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUPipelineBase { getBindGroupLayout(index: number): GPUBindGroupLayout; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUProgrammableStage { module: GPUShaderModule; entryPoint?: string; constants?: Record; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUComputePipeline implements GPUObjectBase, GPUPipelineBase { label: string; getBindGroupLayout(index: number): GPUBindGroupLayout; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUComputePipelineDescriptor extends GPUPipelineDescriptorBase { compute: GPUProgrammableStage; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPURenderPipeline implements GPUObjectBase, GPUPipelineBase { label: string; getBindGroupLayout(index: number): GPUBindGroupLayout; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPURenderPipelineDescriptor extends GPUPipelineDescriptorBase { vertex: GPUVertexState; @@ -880,10 +670,7 @@ declare interface GPURenderPipelineDescriptor fragment?: GPUFragmentState; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUPrimitiveState { topology?: GPUPrimitiveTopology; stripIndexFormat?: GPUIndexFormat; @@ -892,10 +679,7 @@ declare interface GPUPrimitiveState { unclippedDepth?: boolean; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUPrimitiveTopology = | "point-list" | "line-list" @@ -903,40 +687,25 @@ declare type GPUPrimitiveTopology = | "triangle-list" | "triangle-strip"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUFrontFace = "ccw" | "cw"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUCullMode = "none" | "front" | "back"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUMultisampleState { count?: number; mask?: number; alphaToCoverageEnabled?: boolean; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUFragmentState extends GPUProgrammableStage { targets: (GPUColorTargetState | null)[]; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUColorTargetState { format: GPUTextureFormat; @@ -944,25 +713,16 @@ declare interface GPUColorTargetState { writeMask?: GPUColorWriteFlags; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUBlendState { color: GPUBlendComponent; alpha: GPUBlendComponent; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUColorWriteFlags = number; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUColorWrite { static RED: 0x1; static GREEN: 0x2; @@ -971,20 +731,14 @@ declare class GPUColorWrite { static ALL: 0xF; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUBlendComponent { operation?: GPUBlendOperation; srcFactor?: GPUBlendFactor; dstFactor?: GPUBlendFactor; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUBlendFactor = | "zero" | "one" @@ -1000,10 +754,7 @@ declare type GPUBlendFactor = | "constant" | "one-minus-constant"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUBlendOperation = | "add" | "subtract" @@ -1011,10 +762,7 @@ declare type GPUBlendOperation = | "min" | "max"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUDepthStencilState { format: GPUTextureFormat; @@ -1032,10 +780,7 @@ declare interface GPUDepthStencilState { depthBiasClamp?: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUStencilFaceState { compare?: GPUCompareFunction; failOp?: GPUStencilOperation; @@ -1043,10 +788,7 @@ declare interface GPUStencilFaceState { passOp?: GPUStencilOperation; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUStencilOperation = | "keep" | "zero" @@ -1057,16 +799,10 @@ declare type GPUStencilOperation = | "increment-wrap" | "decrement-wrap"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUIndexFormat = "uint16" | "uint32"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUVertexFormat = | "uint8x2" | "uint8x4" @@ -1100,34 +836,22 @@ declare type GPUVertexFormat = | "sint32x4" | "unorm10-10-10-2"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUVertexStepMode = "vertex" | "instance"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUVertexState extends GPUProgrammableStage { buffers?: (GPUVertexBufferLayout | null)[]; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUVertexBufferLayout { arrayStride: number; stepMode?: GPUVertexStepMode; attributes: GPUVertexAttribute[]; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUVertexAttribute { format: GPUVertexFormat; offset: number; @@ -1135,34 +859,22 @@ declare interface GPUVertexAttribute { shaderLocation: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUImageDataLayout { offset?: number; bytesPerRow?: number; rowsPerImage?: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUCommandBuffer implements GPUObjectBase { label: string; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUCommandBufferDescriptor extends GPUObjectDescriptorBase {} -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUCommandEncoder implements GPUObjectBase { label: string; @@ -1220,24 +932,15 @@ declare class GPUCommandEncoder implements GPUObjectBase { finish(descriptor?: GPUCommandBufferDescriptor): GPUCommandBuffer; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUCommandEncoderDescriptor extends GPUObjectDescriptorBase {} -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUImageCopyBuffer extends GPUImageDataLayout { buffer: GPUBuffer; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUImageCopyTexture { texture: GPUTexture; mipLevel?: number; @@ -1245,10 +948,7 @@ declare interface GPUImageCopyTexture { aspect?: GPUTextureAspect; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUProgrammablePassEncoder { setBindGroup( index: number, @@ -1269,10 +969,7 @@ declare interface GPUProgrammablePassEncoder { insertDebugMarker(markerLabel: string): undefined; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUComputePassEncoder implements GPUObjectBase, GPUProgrammablePassEncoder { label: string; @@ -1301,28 +998,19 @@ declare class GPUComputePassEncoder end(): undefined; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUComputePassTimestampWrites { querySet: GPUQuerySet; beginningOfPassWriteIndex?: number; endOfPassWriteIndex?: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUComputePassDescriptor extends GPUObjectDescriptorBase { timestampWrites?: GPUComputePassTimestampWrites; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPURenderEncoderBase { setPipeline(pipeline: GPURenderPipeline): undefined; @@ -1360,10 +1048,7 @@ declare interface GPURenderEncoderBase { ): undefined; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPURenderPassEncoder implements GPUObjectBase, GPUProgrammablePassEncoder, GPURenderEncoderBase { label: string; @@ -1440,20 +1125,14 @@ declare class GPURenderPassEncoder end(): undefined; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPURenderPassTimestampWrites { querySet: GPUQuerySet; beginningOfPassWriteIndex?: number; endOfPassWriteIndex?: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPURenderPassDescriptor extends GPUObjectDescriptorBase { colorAttachments: (GPURenderPassColorAttachment | null)[]; depthStencilAttachment?: GPURenderPassDepthStencilAttachment; @@ -1461,10 +1140,7 @@ declare interface GPURenderPassDescriptor extends GPUObjectDescriptorBase { timestampWrites?: GPURenderPassTimestampWrites; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPURenderPassColorAttachment { view: GPUTextureView; resolveTarget?: GPUTextureView; @@ -1476,7 +1152,7 @@ declare interface GPURenderPassColorAttachment { /** * @category GPU - * @experimental + * @ */ declare interface GPURenderPassDepthStencilAttachment { view: GPUTextureView; @@ -1492,36 +1168,21 @@ declare interface GPURenderPassDepthStencilAttachment { stencilReadOnly?: boolean; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPULoadOp = "load" | "clear"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUStoreOp = "store" | "discard"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPURenderBundle implements GPUObjectBase { label: string; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {} -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPURenderBundleEncoder implements GPUObjectBase, GPUProgrammablePassEncoder, GPURenderEncoderBase { label: string; @@ -1575,29 +1236,20 @@ declare class GPURenderBundleEncoder finish(descriptor?: GPURenderBundleDescriptor): GPURenderBundle; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPURenderPassLayout extends GPUObjectDescriptorBase { colorFormats: (GPUTextureFormat | null)[]; depthStencilFormat?: GPUTextureFormat; sampleCount?: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPURenderBundleEncoderDescriptor extends GPURenderPassLayout { depthReadOnly?: boolean; stencilReadOnly?: boolean; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUQueue implements GPUObjectBase { label: string; @@ -1621,10 +1273,7 @@ declare class GPUQueue implements GPUObjectBase { ): undefined; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUQuerySet implements GPUObjectBase { label: string; @@ -1634,78 +1283,48 @@ declare class GPUQuerySet implements GPUObjectBase { readonly count: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUQuerySetDescriptor extends GPUObjectDescriptorBase { type: GPUQueryType; count: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUQueryType = "occlusion" | "timestamp"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUDeviceLostReason = "destroyed"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUDeviceLostInfo { readonly reason: GPUDeviceLostReason; readonly message: string; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUError { readonly message: string; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUOutOfMemoryError extends GPUError { constructor(message: string); } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUValidationError extends GPUError { constructor(message: string); } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUInternalError extends GPUError { constructor(message: string); } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUErrorFilter = "out-of-memory" | "validation" | "internal"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare class GPUUncapturedErrorEvent extends Event { constructor( type: string, @@ -1715,18 +1334,12 @@ declare class GPUUncapturedErrorEvent extends Event { readonly error: GPUError; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUUncapturedErrorEventInit extends EventInit { error: GPUError; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUColorDict { r: number; g: number; @@ -1734,54 +1347,33 @@ declare interface GPUColorDict { a: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUColor = number[] | GPUColorDict; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUOrigin3DDict { x?: number; y?: number; z?: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUOrigin3D = number[] | GPUOrigin3DDict; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUExtent3DDict { width: number; height?: number; depthOrArrayLayers?: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUExtent3D = number[] | GPUExtent3DDict; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare type GPUCanvasAlphaMode = "opaque" | "premultiplied"; -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUCanvasConfiguration { device: GPUDevice; format: GPUTextureFormat; @@ -1792,10 +1384,7 @@ declare interface GPUCanvasConfiguration { width: number; height: number; } -/** - * @category GPU - * @experimental - */ +/** @category GPU */ declare interface GPUCanvasContext { configure(configuration: GPUCanvasConfiguration): undefined; unconfigure(): undefined; diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index 981dcc01dc..8fb64defd0 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -2143,7 +2143,7 @@ fn lsp_hover_unstable_always_enabled() { "version": 1, // IMPORTANT: If you change this API due to stabilization, also change it // in the enabled test below. - "text": "type _ = Deno.ForeignLibraryInterface;\n" + "text": "type _ = Deno.DatagramConn;\n" } })); let res = client.write_request( @@ -2161,14 +2161,14 @@ fn lsp_hover_unstable_always_enabled() { "contents":[ { "language":"typescript", - "value":"interface Deno.ForeignLibraryInterface" + "value":"interface Deno.DatagramConn" }, - "**UNSTABLE**: New API, yet to be vetted.\n\nA foreign library interface descriptor.", - "\n\n*@category* - FFI \n\n*@experimental*", + "**UNSTABLE**: New API, yet to be vetted.\n\nA generic transport listener for message-oriented protocols.", + "\n\n*@category* - Network \n\n*@experimental*", ], "range":{ "start":{ "line":0, "character":14 }, - "end":{ "line":0, "character":37 } + "end":{ "line":0, "character":26 } } }) ); @@ -2188,7 +2188,7 @@ fn lsp_hover_unstable_enabled() { "uri": "file:///a/file.ts", "languageId": "typescript", "version": 1, - "text": "type _ = Deno.ForeignLibraryInterface;\n" + "text": "type _ = Deno.DatagramConn;\n" } })); let res = client.write_request( @@ -2206,14 +2206,14 @@ fn lsp_hover_unstable_enabled() { "contents":[ { "language":"typescript", - "value":"interface Deno.ForeignLibraryInterface" + "value":"interface Deno.DatagramConn" }, - "**UNSTABLE**: New API, yet to be vetted.\n\nA foreign library interface descriptor.", - "\n\n*@category* - FFI \n\n*@experimental*", + "**UNSTABLE**: New API, yet to be vetted.\n\nA generic transport listener for message-oriented protocols.", + "\n\n*@category* - Network \n\n*@experimental*", ], "range":{ "start":{ "line":0, "character":14 }, - "end":{ "line":0, "character":37 } + "end":{ "line":0, "character":26 } } }) ); diff --git a/tests/specs/check/unstable_suggestion/main.out b/tests/specs/check/unstable_suggestion/main.out index ba8b2800c5..9926c9e3cc 100644 --- a/tests/specs/check/unstable_suggestion/main.out +++ b/tests/specs/check/unstable_suggestion/main.out @@ -1,10 +1,5 @@ Check file:///[WILDLINE]main.ts -error: TS2551 [ERROR]: Property 'dlopen' does not exist on type 'typeof Deno'. Did you mean 'open'? 'Deno.dlopen' is an unstable API. Did you mean 'open'? If not, try changing the 'lib' compiler option to include 'deno.unstable' or add a triple-slash directive to the top of your entrypoint (main file): /// -Deno.dlopen("path/to/lib", {}); - ~~~~~~ +error: TS2339 [ERROR]: Property 'listenDatagram' does not exist on type 'typeof Deno'. 'Deno.listenDatagram' is an unstable API. If not, try changing the 'lib' compiler option to include 'deno.unstable' or add a triple-slash directive to the top of your entrypoint (main file): /// +Deno.listenDatagram({ + ~~~~~~~~~~~~~~ at file:///[WILDLINE]/main.ts:5:6 - - 'open' is declared here. - export function open( - ~~~~ - at asset:///lib.deno.ns.d.ts:[WILDLINE] diff --git a/tests/specs/check/unstable_suggestion/main.ts b/tests/specs/check/unstable_suggestion/main.ts index 02a5cfbdf4..c5c7a82e12 100644 --- a/tests/specs/check/unstable_suggestion/main.ts +++ b/tests/specs/check/unstable_suggestion/main.ts @@ -2,4 +2,7 @@ /// // unstable apis removed here, so should error -Deno.dlopen("path/to/lib", {}); +Deno.listenDatagram({ + port: 3000, + transport: "udp", +}); diff --git a/tools/jsdoc_checker.js b/tools/jsdoc_checker.js index 3e5dc03718..720a8ed8bf 100755 --- a/tools/jsdoc_checker.js +++ b/tools/jsdoc_checker.js @@ -17,11 +17,11 @@ const libs = [ join(ROOT_PATH, "cli/tsc/dts/lib.deno.ns.d.ts"), join(ROOT_PATH, "cli/tsc/dts/lib.deno.shared_globals.d.ts"), join(ROOT_PATH, "cli/tsc/dts/lib.deno.window.d.ts"), + join(ROOT_PATH, "cli/tsc/dts/lib.deno_webgpu.d.ts"), ]; const unstableLibs = [ join(ROOT_PATH, "ext/broadcast_channel/lib.deno_broadcast_channel.d.ts"), - join(ROOT_PATH, "cli/tsc/dts/lib.deno_webgpu.d.ts"), join(ROOT_PATH, "cli/tsc/dts/lib.deno.unstable.d.ts"), ];