diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/error.rs | 4 | ||||
-rw-r--r-- | core/lib.deno_core.d.ts | 11 |
2 files changed, 11 insertions, 4 deletions
diff --git a/core/error.rs b/core/error.rs index 65e2e8da4..1d9df2641 100644 --- a/core/error.rs +++ b/core/error.rs @@ -36,6 +36,10 @@ pub fn type_error(message: impl Into<Cow<'static, str>>) -> AnyError { custom_error("TypeError", message) } +pub fn range_error(message: impl Into<Cow<'static, str>>) -> AnyError { + custom_error("RangeError", message) +} + pub fn invalid_hostname(hostname: &str) -> AnyError { type_error(format!("Invalid hostname: '{}'", hostname)) } diff --git a/core/lib.deno_core.d.ts b/core/lib.deno_core.d.ts index 2da28b413..2cec6be76 100644 --- a/core/lib.deno_core.d.ts +++ b/core/lib.deno_core.d.ts @@ -10,15 +10,15 @@ declare namespace Deno { /** Call an op in Rust, and synchronously receive the result. */ function opSync( opName: string, - args?: any, - zeroCopy?: Uint8Array, + a?: any, + b?: any, ): any; /** Call an op in Rust, and asynchronously receive the result. */ function opAsync( opName: string, - args?: any, - zeroCopy?: Uint8Array, + a?: any, + b?: any, ): Promise<any>; /** @@ -38,5 +38,8 @@ declare namespace Deno { /** Get heap stats for current isolate/worker */ function heapStats(): Record<string, number>; + + /** Encode a string to its Uint8Array representation. */ + function encode(input: string): Uint8Array; } } |