-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
feat(unstable/npm): initial type checking of npm specifiers #16332
Conversation
Investigating why I can't provide tsc that a source file is cjs... might need to use a document registry :(
if let Some(npm_resolver) = &snapshot.maybe_npm_resolver { | ||
// show diagnostics for npm package references that aren't cached | ||
if npm_resolver | ||
.resolve_package_folder_from_deno_module(&pkg_ref.req) | ||
.is_err() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That this handle situation when user has --node-modules-dir
flag specified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. That's not supported at the moment because there's no way to provide that to the lsp at the moment (see second point in pr description). Edit: opened an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally and found a few small problems that were either addressed in this PR or have issues open.
This is already a big PR and it works good enough to land it. Let's iterate further in follow up PRs.
LGTM, amazing work David!
Adds initial support for type checking npm specifiers.
node_modules
folder and prefer to use that? Edit: Opened lsp: should work with local node_modules directory #16373--remote
flag indeno check --remote main.ts
should probably be renameddeno check --all main.ts
to align withdeno run --check=all main.ts
.deno run --check
/deno check
doesn't type check npm packages by default in these changes and--remote
doesn't really make sense for that given we have a distinction between "remote" and npm packages elsewhere (ex.--no-remote
and--no-npm
) Edit: Opened Consider renamingdeno check --remote
to--all
#16374/// <reference types="npm:@types/node" />
directive must be added to the code. This is necessary because there may be scenarios where people want to use npm modules without node types.todo: