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

@deno-types with remote files #419

Open
adamzerner opened this issue Apr 10, 2024 · 0 comments
Open

@deno-types with remote files #419

adamzerner opened this issue Apr 10, 2024 · 0 comments

Comments

@adamzerner
Copy link
Contributor

adamzerner commented Apr 10, 2024

The "Types and Type Declarations" page has a section called "Providing types when importing". That section uses the following example:

// @deno-types="./coolLib.d.ts"

What about when you don't have the *.d.ts file locally though? For example, suppose you want to reference a remote file, or use an npm specifier? Is that possible? If so, I think the docs should describe how and give an example. If not, I think the docs should 1) say so and 2) recommend a workaround.

I tried the following without success:

// @deno-types="npm:@types/react"
import React, { useState } from "react";

But if I use:

"imports": {
  "react": "https://esm.sh/react@18.2.0"
},

instead of:

"imports": {
  "react": "npm:react@18.2.0"
},

I get the types and don't need to use @deno-types (see Discord).

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

1 participant