Deno 属性 'utime' 在类型 'typeof Deno' 上不存在。等待Deno.utime(目的地,statInfo.atime,statInfo.mtime);
Deno Property 'utime' does not exist on type 'typeof Deno'. await Deno.utime(dest, statInfo.atime, statInfo.mtime);
我正在尝试使用标准的 deno fs 模块,但编译器抱怨没有 --unstable
标志。
import { writeJson, readJson } from "https://deno.land/std/fs/mod.ts";
const json = await readJson("input.txt");
console.log(`JSON: ${JSON.stringify(json)}`);
await writeJson("input.txt", json);
我的 deno 版本:
deno 1.0.0-rc2
v8 8.4.300
typescript 3.8.3
我总是遇到同样的错误。它们似乎与缺少的模块有关,但我不确定可能缺少什么。
➜ deno-api denoa filetest.ts
Compile file:///home/astone/source/deno-api/filetest.ts
error: TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'.
await Deno.utime(dest, statInfo.atime, statInfo.mtime);
~~~~~
at https://deno.land/std/fs/copy.ts:90:16
TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'.
Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
~~~~~~~~~
at https://deno.land/std/fs/copy.ts:101:10
TS2339 [ERROR]: Property 'symlink' does not exist on type 'typeof Deno'.
await Deno.symlink(originSrcFilePath, dest, type);
~~~~~~~
at https://deno.land/std/fs/copy.ts:114:14
TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'.
await Deno.utime(dest, statInfo.atime, statInfo.mtime);
~~~~~
at https://deno.land/std/fs/copy.ts:119:16
TS2339 [ERROR]: Property 'symlinkSync' does not exist on type 'typeof Deno'.
Deno.symlinkSync(originSrcFilePath, dest, type);
~~~~~~~~~~~
at https://deno.land/std/fs/copy.ts:132:8
TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'.
Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
~~~~~~~~~
at https://deno.land/std/fs/copy.ts:137:10
TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'.
await Deno.utime(dest, srcStatInfo.atime, srcStatInfo.mtime);
~~~~~
at https://deno.land/std/fs/copy.ts:157:16
TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'.
Deno.utimeSync(dest, srcStatInfo.atime, srcStatInfo.mtime);
~~~~~~~~~
at https://deno.land/std/fs/copy.ts:185:10
TS2339 [ERROR]: Property 'link' does not exist on type 'typeof Deno'.
await Deno.link(src, dest);
~~~~
at https://deno.land/std/fs/ensure_link.ts:28:14
TS2339 [ERROR]: Property 'linkSync' does not exist on type 'typeof Deno'.
Deno.linkSync(src, dest);
~~~~~~~~
at https://deno.land/std/fs/ensure_link.ts:52:8
TS2339 [ERROR]: Property 'symlink' does not exist on type 'typeof Deno'.
await Deno.symlink(src, dest, srcFilePathType);
~~~~~~~
at https://deno.land/std/fs/ensure_symlink.ts:31:14
TS2339 [ERROR]: Property 'symlinkSync' does not exist on type 'typeof Deno'.
Deno.symlinkSync(src, dest, srcFilePathType);
~~~~~~~~~~~
at https://deno.land/std/fs/ensure_symlink.ts:58:8
Found 12 errors.
如果我只导入 readJson 模块,那么我不会收到错误。
import { readJson } from "https://deno.land/std/fs/read_json.ts";
我尝试使用标签构建,但我似乎无法找出 1.0.0-rc2
的标签。我试过了 https://deno.land/std@0.50.0/fs/mod.ts
.
Deno.utime
有 been marked unstable,这就是为什么你应该使用 --unstable
标志
还有一个未解决的问题:Property 'utime' does not exist on type 'typeof Deno' 此错误。
目前有多个APIs which are behind the unstable flag。
As of Deno 1.0.0, the Deno namespace APIs are stable. That means that
we will strive to make code working under 1.0.0 continue to work in
future versions.
However, not all of Deno's features are ready for production yet.
Features which are not ready because they are still in draft phase are
locked behind the --unstable command line flag.
使用 Deno.utime
的文件是 copy.ts
& ensure_symlink.ts
这就是为什么如果你只加载 read_json.ts
你不会得到那个错误的原因,并且不需要不稳定的标志。
std/
的最新标签是 std/0.50.0
,但您始终可以将 github 存储库直接引用到您想要的任何提交或发布标签。
https://raw.githubusercontent.com/denoland/deno/{tag}/std/fs/read_json.ts
因此您可以将以下内容用于您的代码段:
import { readJson } from 'https://raw.githubusercontent.com/denoland/deno/v1.0.0-rc2/std/fs/read_json.ts'
import { writeJson } from 'https://raw.githubusercontent.com/denoland/deno/v1.0.0-rc2/std/fs/write_json.ts'
我正在尝试使用标准的 deno fs 模块,但编译器抱怨没有 --unstable
标志。
import { writeJson, readJson } from "https://deno.land/std/fs/mod.ts";
const json = await readJson("input.txt");
console.log(`JSON: ${JSON.stringify(json)}`);
await writeJson("input.txt", json);
我的 deno 版本:
deno 1.0.0-rc2
v8 8.4.300
typescript 3.8.3
我总是遇到同样的错误。它们似乎与缺少的模块有关,但我不确定可能缺少什么。
➜ deno-api denoa filetest.ts
Compile file:///home/astone/source/deno-api/filetest.ts
error: TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'.
await Deno.utime(dest, statInfo.atime, statInfo.mtime);
~~~~~
at https://deno.land/std/fs/copy.ts:90:16
TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'.
Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
~~~~~~~~~
at https://deno.land/std/fs/copy.ts:101:10
TS2339 [ERROR]: Property 'symlink' does not exist on type 'typeof Deno'.
await Deno.symlink(originSrcFilePath, dest, type);
~~~~~~~
at https://deno.land/std/fs/copy.ts:114:14
TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'.
await Deno.utime(dest, statInfo.atime, statInfo.mtime);
~~~~~
at https://deno.land/std/fs/copy.ts:119:16
TS2339 [ERROR]: Property 'symlinkSync' does not exist on type 'typeof Deno'.
Deno.symlinkSync(originSrcFilePath, dest, type);
~~~~~~~~~~~
at https://deno.land/std/fs/copy.ts:132:8
TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'.
Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
~~~~~~~~~
at https://deno.land/std/fs/copy.ts:137:10
TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'.
await Deno.utime(dest, srcStatInfo.atime, srcStatInfo.mtime);
~~~~~
at https://deno.land/std/fs/copy.ts:157:16
TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'.
Deno.utimeSync(dest, srcStatInfo.atime, srcStatInfo.mtime);
~~~~~~~~~
at https://deno.land/std/fs/copy.ts:185:10
TS2339 [ERROR]: Property 'link' does not exist on type 'typeof Deno'.
await Deno.link(src, dest);
~~~~
at https://deno.land/std/fs/ensure_link.ts:28:14
TS2339 [ERROR]: Property 'linkSync' does not exist on type 'typeof Deno'.
Deno.linkSync(src, dest);
~~~~~~~~
at https://deno.land/std/fs/ensure_link.ts:52:8
TS2339 [ERROR]: Property 'symlink' does not exist on type 'typeof Deno'.
await Deno.symlink(src, dest, srcFilePathType);
~~~~~~~
at https://deno.land/std/fs/ensure_symlink.ts:31:14
TS2339 [ERROR]: Property 'symlinkSync' does not exist on type 'typeof Deno'.
Deno.symlinkSync(src, dest, srcFilePathType);
~~~~~~~~~~~
at https://deno.land/std/fs/ensure_symlink.ts:58:8
Found 12 errors.
如果我只导入 readJson 模块,那么我不会收到错误。
import { readJson } from "https://deno.land/std/fs/read_json.ts";
我尝试使用标签构建,但我似乎无法找出 1.0.0-rc2
的标签。我试过了 https://deno.land/std@0.50.0/fs/mod.ts
.
Deno.utime
有 been marked unstable,这就是为什么你应该使用 --unstable
标志
还有一个未解决的问题:Property 'utime' does not exist on type 'typeof Deno' 此错误。
目前有多个APIs which are behind the unstable flag。
As of Deno 1.0.0, the Deno namespace APIs are stable. That means that we will strive to make code working under 1.0.0 continue to work in future versions.
However, not all of Deno's features are ready for production yet. Features which are not ready because they are still in draft phase are locked behind the --unstable command line flag.
使用 Deno.utime
的文件是 copy.ts
& ensure_symlink.ts
这就是为什么如果你只加载 read_json.ts
你不会得到那个错误的原因,并且不需要不稳定的标志。
std/
的最新标签是 std/0.50.0
,但您始终可以将 github 存储库直接引用到您想要的任何提交或发布标签。
https://raw.githubusercontent.com/denoland/deno/{tag}/std/fs/read_json.ts
因此您可以将以下内容用于您的代码段:
import { readJson } from 'https://raw.githubusercontent.com/denoland/deno/v1.0.0-rc2/std/fs/read_json.ts'
import { writeJson } from 'https://raw.githubusercontent.com/denoland/deno/v1.0.0-rc2/std/fs/write_json.ts'