Skip to content

Autocompletions and quick fix suggestions try to import from "@types" packages #2576

@kyle-sawatsky

Description

@kyle-sawatsky

Steps to reproduce

I scaffolded a basic vite+react+typescript app vite create via pnpm. Then installed the latest native preview and extension into vscode.

https://github.com/kyle-sawatsky/tsgo-test-import

Open App.tsx and remove the import of useState. Attempt a Quick Fix and it suggests to import useState from "@types/react" which you can go ahead and do and immediately receive Cannot import type declaration files. Consider importing 'react' instead of '@types/react'.

Behavior with [email protected]

Disable the native preview and redo the steps. It will correctly suggest that you import from "react".

Behavior with tsgo

Tries to import from a type declaration file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions