strmnn
strmnn3w ago

jsdoc `@import` ignored by `deno check` but not by LSP

This code displays an error correctly in VSCode:
/**
* @import { And } from "@pumpn/type-party";
*/

/**
* @type {([
* And<true, true>,
* And<true, false>,
* And<false, true>,
* And<false, false>
* ])}
*/
const result = [
true,
false,
false,
true // Type 'true' is not assignable to type 'false'.deno-ts(2322)
];

export default result;
/**
* @import { And } from "@pumpn/type-party";
*/

/**
* @type {([
* And<true, true>,
* And<true, false>,
* And<false, true>,
* And<false, false>
* ])}
*/
const result = [
true,
false,
false,
true // Type 'true' is not assignable to type 'false'.deno-ts(2322)
];

export default result;
But running deno check on the same file emits no error at all. If one now changes the code to use the more verbose @typedef way of importing jsdoc types:
/**
* @template {boolean} A
* @template {boolean} B
* @typedef {import("@pumpn/type-party").And<A,B>} And<A,B>
*/

/**
* @type {([
* And<true, true>,
* And<true, false>,
* And<false, true>,
* And<false, false>
* ])}
*/
const result = [
true,
false,
false,
true // Type 'true' is not assignable to type 'false'.deno-ts(2322)
];

export default result;
/**
* @template {boolean} A
* @template {boolean} B
* @typedef {import("@pumpn/type-party").And<A,B>} And<A,B>
*/

/**
* @type {([
* And<true, true>,
* And<true, false>,
* And<false, true>,
* And<false, false>
* ])}
*/
const result = [
true,
false,
false,
true // Type 'true' is not assignable to type 'false'.deno-ts(2322)
];

export default result;
The errors appear in both VSCode and deno check. What am I doing wrong?
0 Replies
No replies yetBe the first to reply to this messageJoin