From 2b2644458494ce661fdb6ad0a6f753e04c742fac Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 25 Nov 2024 18:57:05 -0500 Subject: [PATCH] fix(check): support jsdoc `@import` tag (#26991) * https://github.com/denoland/deno_graph/pull/544 Closes https://github.com/denoland/deno/issues/25516 --- Cargo.lock | 4 ++-- cli/Cargo.toml | 2 +- tests/specs/check/jsdoc_import_decl/__test__.jsonc | 5 +++++ tests/specs/check/jsdoc_import_decl/check.out | 6 ++++++ tests/specs/check/jsdoc_import_decl/main.js | 12 ++++++++++++ 5 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 tests/specs/check/jsdoc_import_decl/__test__.jsonc create mode 100644 tests/specs/check/jsdoc_import_decl/check.out create mode 100644 tests/specs/check/jsdoc_import_decl/main.js diff --git a/Cargo.lock b/Cargo.lock index e7229dcceb..98792c58b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1664,9 +1664,9 @@ dependencies = [ [[package]] name = "deno_graph" -version = "0.85.0" +version = "0.85.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d097305aba3f119781fe82b4d5a85a1ad10c586a388ee4d754e5bf82901cc5c" +checksum = "4c11027d9b4e9ff4f8bcb8316a1a5dd5241dc267380507e177457bc491696189" dependencies = [ "anyhow", "async-trait", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index ce9dbe9230..d1ac3e160e 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -73,7 +73,7 @@ deno_cache_dir.workspace = true deno_config.workspace = true deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] } deno_doc = { version = "0.160.0", features = ["rust", "comrak"] } -deno_graph = { version = "=0.85.0" } +deno_graph = { version = "=0.85.1" } deno_lint = { version = "=0.68.0", features = ["docs"] } deno_lockfile.workspace = true deno_npm.workspace = true diff --git a/tests/specs/check/jsdoc_import_decl/__test__.jsonc b/tests/specs/check/jsdoc_import_decl/__test__.jsonc new file mode 100644 index 0000000000..fdbb52ab35 --- /dev/null +++ b/tests/specs/check/jsdoc_import_decl/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "check --allow-import main.js", + "output": "check.out", + "exitCode": 1 +} diff --git a/tests/specs/check/jsdoc_import_decl/check.out b/tests/specs/check/jsdoc_import_decl/check.out new file mode 100644 index 0000000000..657569bcd4 --- /dev/null +++ b/tests/specs/check/jsdoc_import_decl/check.out @@ -0,0 +1,6 @@ +Download http://localhost:4545/add.ts +Check file:///[WILDLINE]main.js +error: TS2345 [ERROR]: Argument of type 'string' is not assignable to parameter of type '(a: number, b: number) => number'. +addHere(""); + ~~ + at file:///[WILDLINE]main.js:12:9 diff --git a/tests/specs/check/jsdoc_import_decl/main.js b/tests/specs/check/jsdoc_import_decl/main.js new file mode 100644 index 0000000000..accfdb177a --- /dev/null +++ b/tests/specs/check/jsdoc_import_decl/main.js @@ -0,0 +1,12 @@ +// @ts-check + +/** @import { add } from "http://localhost:4545/add.ts" */ + +/** + * @param {typeof add} myValue + */ +export function addHere(myValue) { + return myValue(1, 2); +} + +addHere("");