DenoDDeno
Powered by
strmnnS
Denoβ€’2y ago
strmnn

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
deno check
on the same file emits no error at all.

If one now changes the code to use the more verbose
@typedef
@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
deno check
.

What am I doing wrong?
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

JSDoc inline import with Deno LSP does not find or apply type from npm package
tacoTtaco / help
15mo ago
Deno LSP Issue with import maps?
ZidanZZidan / help
2y ago
Deno LSP not narrowing types
BreadBBread / help
9mo ago
deno lsp over named pipe?
GreedoGGreedo / help
2y ago