deno/resolvers/deno
Nathan Whitaker 08f5e797b6
fix(check/lsp): fall back to @types/* packages if npm package doesn't have types (#28185)
Fixes https://github.com/denoland/deno/issues/27569.
Fixes https://github.com/denoland/deno/issues/27215.

This PR makes it so type resolution falls back to looking for definitely
typed packages (`@types/foo`) if a given NPM package does not contain
type declarations.

One complication is choosing _which_ version of the `@types/*` package
to use, if the project depends on multiple versions. The heuristic here
is to try to match the major and minor versions, falling back to the
latest version. So if you have
```
@types/foo: 0.1.0, 0.2.0, 3.1.0, 3.1.2, 4.0.0
foo: 3.1.0
```
we would choose `@types/foo@3.1.2` when resolving types for `foo`.

---

Note that this only uses `@types/` packages if you _already_ depend on
them. So a follow up to this PR could be to add a diagnostic and
quickfix to install `@types/foo` if we don't find types for `foo`.
2025-02-19 23:55:06 +00:00
..
npm fix(check/lsp): fall back to @types/* packages if npm package doesn't have types (#28185) 2025-02-19 23:55:06 +00:00
Cargo.toml 2.2.0 (#28175) 2025-02-18 23:12:17 +00:00
cjs.rs fix(node): resolve module as maybe CJS when it's missing a file extension (#27904) 2025-02-01 13:12:17 -05:00
clippy.toml refactor: add 'sync' feature to deno_resolver crate (#27357) 2024-12-15 09:18:04 +01:00
factory.rs fix(check): support sloppy imports with "compilerOptions.rootDirs" (#27973) 2025-02-05 23:08:10 +00:00
lib.rs fix(check): support sloppy imports with "compilerOptions.rootDirs" (#27973) 2025-02-05 23:08:10 +00:00
npmrc.rs fix(npmrc): merge .npmrc in user's homedir and project (#27119) 2025-01-28 15:25:50 +00:00
README.md refactor: extract out sloppy imports resolution from CLI crate (#25920) 2024-09-28 19:17:48 -04:00
sync.rs refactor: remove CliNpmReqResolver trait in deno_resolver (#27616) 2025-01-10 14:48:43 -05:00
workspace.rs fix(check): support sloppy imports with "compilerOptions.rootDirs" (#27973) 2025-02-05 23:08:10 +00:00

deno_resolver

Deno resolution algorithm.