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 comment works incorrectly #25644

Open
happyhunter7 opened this issue Sep 15, 2024 · 2 comments
Open

@deno-types comment works incorrectly #25644

happyhunter7 opened this issue Sep 15, 2024 · 2 comments
Assignees
Labels
bug Something isn't working correctly tsc related to the TypeScript tsc compiler

Comments

@happyhunter7
Copy link

Version: Deno 1.46.3
Using latest version of VScode with latest version of Deno official extension for vscode

The bug:
When using a import that starts with 'type' word, then when you hover in vscode on that type "FC" it shows nothing, which means it could not resolve from where it should be imported or something like that, when ctrl+click on 'react' it also doesn't open the react types file.

// @deno-types="@types/react"
import type { FC } from 'react'

The Fix:
Move type inside {}, after that everything works as expected, on hover it shows the type definition, and clicking on 'react' word it opens in the editor the react type defs

// @deno-types="@types/react"
import { type  FC } from 'react'

But with this tow work I have to exclude linter rule 'verbatim-module-syntax' from linter so that it doesn't complain

Expectation:
Well I expect that both import syntaxes works the same as it does in node, and I get the type definition when howering, and the autocomplition same as in the second scenario but without turning off linter rule verbatim-module-syntax

@lucacasonato lucacasonato added the bug Something isn't working correctly label Sep 16, 2024
@nayeemrmn
Copy link
Collaborator

This occurs with deno check as well.

// @deno-types="npm:@types/react@^18.3.6"
import type { ShouldError as _ } from 'npm:react@^18.3.1';

@nayeemrmn nayeemrmn added types Issues related to TypeScript types tsc related to the TypeScript tsc compiler and removed types Issues related to TypeScript types labels Sep 16, 2024
@nayeemrmn
Copy link
Collaborator

I suppose you may as well write import type { FC } from '@types/react' which is kind of why it behaves this way, but it makes more sense to prioritise @deno-types. We'll fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly tsc related to the TypeScript tsc compiler
Projects
None yet
Development

No branches or pull requests

3 participants