diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/build.rs | 2 | ||||
-rw-r--r-- | cli/dts/lib.esnext.d.ts | 2 | ||||
-rw-r--r-- | cli/dts/lib.esnext.error.d.ts | 16 | ||||
-rw-r--r-- | cli/dts/lib.esnext.object.d.ts | 12 | ||||
-rw-r--r-- | cli/tests/unit/esnext_test.ts | 13 | ||||
-rw-r--r-- | cli/tsc/00_typescript.js | 2 |
6 files changed, 46 insertions, 1 deletions
diff --git a/cli/build.rs b/cli/build.rs index d7bed218c..3bc39c8f4 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -130,7 +130,9 @@ fn create_compiler_snapshot( "es2021.string", "es2021.weakref", "esnext", + "esnext.error", "esnext.intl", + "esnext.object", "esnext.promise", "esnext.string", "esnext.weakref", diff --git a/cli/dts/lib.esnext.d.ts b/cli/dts/lib.esnext.d.ts index a71ac70e6..0e23bff0f 100644 --- a/cli/dts/lib.esnext.d.ts +++ b/cli/dts/lib.esnext.d.ts @@ -20,5 +20,7 @@ and limitations under the License. /// <reference lib="es2021" /> /// <reference lib="esnext.array" /> +/// <reference lib="esnext.error" /> /// <reference lib="esnext.intl" /> +/// <reference lib="esnext.object" /> /// <reference lib="esnext.string" /> diff --git a/cli/dts/lib.esnext.error.d.ts b/cli/dts/lib.esnext.error.d.ts new file mode 100644 index 000000000..fa06d6f58 --- /dev/null +++ b/cli/dts/lib.esnext.error.d.ts @@ -0,0 +1,16 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. + +/// <reference no-default-lib="true"/> + +interface Error { + cause?: any; +} + +interface ErrorInit { + cause?: any; +} + +interface ErrorConstructor { + new (message?: string, init?: ErrorInit): Error; + (message?: string, init?: ErrorInit): Error; +} diff --git a/cli/dts/lib.esnext.object.d.ts b/cli/dts/lib.esnext.object.d.ts new file mode 100644 index 000000000..4140f9334 --- /dev/null +++ b/cli/dts/lib.esnext.object.d.ts @@ -0,0 +1,12 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. + +/// <reference no-default-lib="true"/> + +interface ObjectConstructor { + /** + * Determines whether an object has a property with the specified name. + * @param o The target object. + * @param v A property name. + */ + hasOwn(o: object, v: PropertyKey): boolean; +} diff --git a/cli/tests/unit/esnext_test.ts b/cli/tests/unit/esnext_test.ts index 558c678bc..5d858e267 100644 --- a/cli/tests/unit/esnext_test.ts +++ b/cli/tests/unit/esnext_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -import { assertEquals, unitTest } from "./test_util.ts"; +import { assert, assertEquals, unitTest } from "./test_util.ts"; // TODO(@kitsonk) remove when we are no longer patching TypeScript to have // these types available. @@ -10,3 +10,14 @@ unitTest(function typeCheckingEsNextArrayString() { const b = ["a", "b", "c", "d", "e", "f"]; assertEquals(b.at(-1), "f"); }); + +unitTest(function objectHasOwn() { + const a = { a: 1 }; + assert(Object.hasOwn(a, "a")); + assert(!Object.hasOwn(a, "b")); +}); + +unitTest(function errorCause() { + const e = new Error("test", { cause: "something" }); + assertEquals(e.cause, "something"); +}); diff --git a/cli/tsc/00_typescript.js b/cli/tsc/00_typescript.js index 5b8d64c5f..b1d91d541 100644 --- a/cli/tsc/00_typescript.js +++ b/cli/tsc/00_typescript.js @@ -37080,6 +37080,8 @@ var ts; ["es2021.promise", "lib.es2021.promise.d.ts"], ["es2021.string", "lib.es2021.string.d.ts"], ["es2021.weakref", "lib.es2021.weakref.d.ts"], + ["esnext.object", "lib.esnext.object.d.ts"], + ["esnext.error", "lib.esnext.error.d.ts"], ["esnext.array", "lib.esnext.array.d.ts"], ["esnext.symbol", "lib.es2019.symbol.d.ts"], ["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"], |