Skip to content

NPM packages not getting type definitions from @types/* #28464

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

Closed
ThatBlockyPenguin opened this issue Mar 11, 2025 · 2 comments
Closed

NPM packages not getting type definitions from @types/* #28464

ThatBlockyPenguin opened this issue Mar 11, 2025 · 2 comments

Comments

@ThatBlockyPenguin
Copy link

Just ran into this issue myself, but for whatever reason, it isn't working for me... If it's of any help, the output of ctrl+shift+p Deno: Info is:

deno 2.2.2 (release, x86_64-pc-windows-msvc) | vscode_deno 3.43.4 | vscode 1.97.2

@ThatBlockyPenguin Can you open a new issue with a reproduction and more details about the problem?

Originally posted by @nathanwhit in #27569


I certainly can!
I'm reporting this issue from a different computer (with the same issue).

System info

deno 2.2.3 (release, x86_64-unknown-linux-gnu) | vscode_deno 3.43.5 | vscode 1.98.0

My specific Linux distro is Manjaro Linux.

Steps to Reproduce:

  1. Create a new file with the following contents (copied from original issue):
    import { useEffect } from "react";
    
    const foo: string = useEffect; // this assignment should report a type error, but doesn't
    console.log(foo);
    
  2. Run deno add npm:react.
  3. See that no type checking is present:
    Image
    Image
@nathanwhit
Copy link
Member

Ah, you need to deno add npm:@types/react as well.

I have a WIP change to have a diagnostic in the editor that can do it for you: #28216

@ThatBlockyPenguin
Copy link
Author

Ah, you need to deno add npm:@types/react as well.

smacks forehead of course you do! I genuinely can't believe I forgot to check that!

I have a WIP change to have a diagnostic in the editor that can do it for you: #28216

This very situation tells me that that's going to be very very useful. Sorry for wasting your time, and thanks a bunch!

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