deno: Property 'utime' does not exist on type 'typeof Deno'
I’m trying the following script and I get a few errors.
index.ts
import { exists } from "https://deno.land/std/fs/mod.ts";
const found = await exists('/folder');
console.log('Found:', found);
Error:
error TS2339: 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
error TS2339: 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
error TS2339: 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
error TS2339: 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
error TS2339: Property 'symlinkSync' does not exist on type 'typeof Deno'.
Deno.symlinkSync(originSrcFilePath, dest, type);
~~~~~~~~~~~
at https://deno.land/std/fs/copy.ts:132:8
error TS2339: 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
error TS2339: 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
error TS2339: 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
error TS2339: 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
error TS2339: Property 'linkSync' does not exist on type 'typeof Deno'.
Deno.linkSync(src, dest);
~~~~~~~~
at https://deno.land/std/fs/ensure_link.ts:52:8
error TS2339: 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
error TS2339: 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.
deno 1.0.0-rc1 v8 8.2.308 typescript 3.8.3
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 9
- Comments: 16 (9 by maintainers)
It is not ideal that some modules in std require --unstable (especially mod.ts files).
Perhaps it makes sense to separate/group path/mod.ts and path/unstable.ts?
At the moment if I want to use path.join, I’m out of luck, even though it doesn’t - as far as I can tell - itself use an unstable api. That doesn’t really make sense.
These features are now under the
--unstableflag… To enable them,deno run --unstable.https://github.com/denoland/deno/issues/5630 <- there was a similar issue.
I think there are two main culprits here:
--unstablein std packages is weird. I dislike that behaviour with passion.Please update README to specify
deno run --unstableis required.What if we made the missing
--unstableflag cause a runtime error instead of at compile time? Would that be better?I had an idea on how to implement that, link here… I might have posted it in the wrong place though. Basically what it would do is throw an error if you try to use an unstable API without the unstable flag.
What’s nice about it is that you don’t need to maintain a list of unstable API names, and it also doesn’t require trapping the diagnostic messages and doing a string search and replace
@Driky I believe you need to specify the standard library’s version like this:
Better docs were added in https://github.com/denoland/deno/pull/5456
@mickaelvieira thank you I’ll test that EDIT: that works