1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00

docs(cli/dts): explicitly import assert in examples (#10495)

This commit is contained in:
Casper Beyer 2021-05-05 13:50:38 +08:00 committed by GitHub
parent f44a5706e6
commit 9c206545f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1575,6 +1575,7 @@ declare namespace Deno {
* what it points to.. * what it points to..
* *
* ```ts * ```ts
* import { assert } from "https://deno.land/std/testing/asserts.ts";
* const fileInfo = Deno.lstatSync("hello.txt"); * const fileInfo = Deno.lstatSync("hello.txt");
* assert(fileInfo.isFile); * assert(fileInfo.isFile);
* ``` * ```
@ -2247,6 +2248,7 @@ declare namespace Deno {
/** Revokes a permission, and resolves to the state of the permission. /** Revokes a permission, and resolves to the state of the permission.
* *
* ```ts * ```ts
* import { assert } from "https://deno.land/std/testing/asserts.ts";
* const status = await Deno.permissions.revoke({ name: "run" }); * const status = await Deno.permissions.revoke({ name: "run" });
* assert(status.state !== "granted") * assert(status.state !== "granted")
* ``` * ```
@ -2411,6 +2413,7 @@ declare namespace Deno {
* Synchronously returns a `Deno.FileInfo` for the given file stream. * Synchronously returns a `Deno.FileInfo` for the given file stream.
* *
* ```ts * ```ts
* import { assert } from "https://deno.land/std/testing/asserts.ts";
* const file = Deno.openSync("file.txt", { read: true }); * const file = Deno.openSync("file.txt", { read: true });
* const fileInfo = Deno.fstatSync(file.rid); * const fileInfo = Deno.fstatSync(file.rid);
* assert(fileInfo.isFile); * assert(fileInfo.isFile);
@ -2422,6 +2425,7 @@ declare namespace Deno {
* Returns a `Deno.FileInfo` for the given file stream. * Returns a `Deno.FileInfo` for the given file stream.
* *
* ```ts * ```ts
* import { assert } from "https://deno.land/std/testing/asserts.ts";
* const file = await Deno.open("file.txt", { read: true }); * const file = await Deno.open("file.txt", { read: true });
* const fileInfo = await Deno.fstat(file.rid); * const fileInfo = await Deno.fstat(file.rid);
* assert(fileInfo.isFile); * assert(fileInfo.isFile);