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

bug?: deno check need --unstable flags but already include #20248

Closed
afifurrohman-id opened this issue Aug 23, 2023 · 4 comments
Closed

bug?: deno check need --unstable flags but already include #20248

afifurrohman-id opened this issue Aug 23, 2023 · 4 comments
Labels
question a question about the use of Deno

Comments

@afifurrohman-id
Copy link

afifurrohman-id commented Aug 23, 2023

Description

When i using fresh from project template and i run deno task start will got error need --unstable flags, but i already include

In Deno json

{
"tasks"{
    "check": "deno lint --unstable . && deno check --unstable **/*.ts && deno check --unstable **/*.tsx"
  }
}

Error

error: TS2551 [ERROR]: Property 'openKv' does not exist on type 'typeof Deno'. Did you mean 'open'? 'Deno.openKv' is an unstable API. Did you forget to run with the '--unstable' flag, or did you mean 'open'? If not, try changing the 'lib' compiler option to include 'deno.unstable' or add a triple-slash directive to the top of your entrypoint (main file): /// <reference lib="deno.unstable" />
export const kvDb = await Deno.openKv()
                               ~~~~~~
    at file:///D:/path/to/ptoject/db.ts:4:32

    'open' is declared here.
      export function open(
                      ~~~~
        at asset:///lib.deno.ns.d.ts:1709:19

But When i run command immediately no problem

deno lint --unstable . && deno check --unstable **/*.ts && deno check --unstable **/*.tsx
@dsherret
Copy link
Member

Follow this step on the error message:

or add a triple-slash directive to the top of your entrypoint (main file): /// <reference lib="deno.unstable" />

It's necessary in Fresh because it adds /// <reference no-default-lib="true" /> to the entrypoint, which will erase the unstable types, but adding /// <reference lib="deno.unstable" /> will add them back.

https://github.com/denoland/fresh/blob/fb6d11747b0f0e17af0e43be2331db35946c6900/www/main.ts#L1

@dsherret dsherret added the question a question about the use of Deno label Aug 23, 2023
@sigmaSd
Copy link
Contributor

sigmaSd commented Aug 23, 2023

related denoland/fresh#822

@afifurrohman-id
Copy link
Author

Follow this step on the error message:

or add a triple-slash directive to the top of your entrypoint (main file): /// <reference lib="deno.unstable" />

It's necessary in Fresh because it adds /// <reference no-default-lib="true" /> to the entrypoint, which will erase the unstable types, but adding /// <reference lib="deno.unstable" /> will add them back.

https://github.com/denoland/fresh/blob/fb6d11747b0f0e17af0e43be2331db35946c6900/www/main.ts#L1

I have already added

@dsherret
Copy link
Member

Follow updates on this in #20420

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question a question about the use of Deno
Projects
None yet
Development

No branches or pull requests

3 participants