Open scarf005 opened 11 months ago
Version: Deno 1.39.0+d51fda9 (canary, x86_64-unknown-linux-gnu)
add.js
/// <reference types="./add.d.ts" /> export const add = (a) => a + 1
add.d.ts
export declare const add: (a: number) => number
use.ts
import { add } from "./add.js"
deno.jsonc
{ "compilerOptions": { "checkJs": true } }
both CLI and LSP type checks add.js and use.ts according to https://docs.deno.com/runtime/manual/advanced/typescript/types#using-the-triple-slash-reference-directive
$ deno check use.ts Check file:///home/scarf/repo/deno/cjk_slug/use.ts error: TS7006 [ERROR]: Parameter 'a' implicitly has an 'any' type. export const add = (a) => a + 1 ^ at file:///home/scarf/repo/deno/cjk_slug/add.js:2:21 $ deno check add.js Check file:///home/scarf/repo/deno/cjk_slug/add.js error: TS7006 [ERROR]: Parameter 'a' implicitly has an 'any' type. export const add = (a) => a + 1
both fails to type check.
Huh, I think declaration links should override any type analysis of JS files, checkJs or not.
checkJs
Version: Deno 1.39.0+d51fda9 (canary, x86_64-unknown-linux-gnu)
Minimal Reproduction
add.js
add.d.ts
use.ts
deno.jsonc
Expected behavior
both CLI and LSP type checks
add.js
anduse.ts
according to https://docs.deno.com/runtime/manual/advanced/typescript/types#using-the-triple-slash-reference-directiveActual behavior
both fails to type check.