Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing --unstable flag gives non-obvious errors #5783

Closed
cknight opened this issue May 23, 2020 · 2 comments
Closed

Missing --unstable flag gives non-obvious errors #5783

cknight opened this issue May 23, 2020 · 2 comments

Comments

@cknight
Copy link
Contributor

cknight commented May 23, 2020

Errors for use of non stable APIs are non-obvious. For example:

$ deno run --allow-read --allow-write main.ts
Compile file:///dev/deno/main.ts
Download https://deno.land/std@0.50.0/fs/copy.ts
Download https://deno.land/std@0.50.0/fs/ensure_dir.ts
Download https://deno.land/std@0.50.0/fs/_util.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@0.50.0/fs/copy.ts:90:16

Is there a way that we could include the unstable types at runtime where they could be checked (but not used) when errors of type Property xyz does not exist... occur to provide a more helpful error message?

That would allow us to output something like:

$ deno run --allow-read --allow-write main.ts
Compile file:///dev/deno/main.ts
Download https://deno.land/std@0.50.0/fs/copy.ts
Download https://deno.land/std@0.50.0/fs/ensure_dir.ts
Download https://deno.land/std@0.50.0/fs/_util.ts
error: TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'.  
'utime' is an unstable property of Deno.  Add the --unstable flag to enable use.
    await Deno.utime(dest, statInfo.atime, statInfo.mtime);
               ~~~~~
    at https://deno.land/std@0.50.0/fs/copy.ts:90:16
@lucacasonato
Copy link
Member

lucacasonato commented May 23, 2020

Duplicate of #5175. Ref #5503

@cknight
Copy link
Contributor Author

cknight commented May 23, 2020

Thanks @lucacasonato , closing in favor of those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants