Microsoft/TypeScript

JSDoc @type completion not working inside function argument

Open

#62,281 opened on Aug 13, 2025

View on GitHub
ย (0 comments)ย (0 reactions)ย (0 assignees)TypeScriptย (48,455 stars)ย (6,726 forks)batch import
Domain: JSDocHelp WantedPossible Improvement

Description

๐Ÿ”Ž Search Terms

jsdoc, completion

๐Ÿ•— Version & Regression Information

Never seems to have worked

โฏ Playground Link

No response

๐Ÿ’ป Code

JSDoc has some completion issues with completions like this:

function someFunc(/** @type {^cursor here^} **/) {}

โŒ Does not work - @type completion (in function argument) from @import with named argument

///<reference path="fourslash.ts" />

// @allowJS: true
// @checkJs: true
// @module: esnext

// @filename: ./a.ts
////export interface ABC {}

// @filename: ./b.js
/////** @import * as t from "./a" */
////function someFunc(/** @type {t./**/} */arg) {}

verify.completions({
    marker: "",
    includes: "ABC",
});

โœ… Works - @type completion (in function argument) from @typedef and with named argument

///<reference path="fourslash.ts" />

// @allowJS: true
// @checkJs: true
// @module: esnext

// @filename: ./b.js
/////** @typedef {number} SomeNumber */
////function someFunc(/** @type {S/**/} */arg) {}

verify.completions({
    marker: "",
    includes: "SomeNumber",
});

โœ… Works - @type completion (not part of function argument) from @import completion inside

///<reference path="fourslash.ts" />

// @allowJS: true
// @checkJs: true
// @module: esnext

// @filename: ./a.ts
////export interface ABC {}

// @filename: ./b.js
/////** @import * as t from "./a" */
/////** @type {t./**/} */

verify.completions({
    marker: "",
    includes: "ABC",
});

โŒ Does not work - @type completion (in function argument) from @import (argument not named yet)

///<reference path="fourslash.ts" />

// @allowJS: true
// @checkJs: true
// @module: esnext

// @filename: ./a.ts
////export interface ABC {}

// @filename: ./b.js
/////** @import * as t from "./a" */
////function someFunc(/** @type {t./**/} */) {}

verify.completions({
    marker: "",
    includes: "ABC",
});

โŒ Does not work - @type completion (in function argument) @typedef (argument not named yet)

///<reference path="fourslash.ts" />

// @allowJS: true
// @checkJs: true
// @module: esnext

// @filename: ./b.js
/////** @typedef {number} SomeNumber */
////function someFunc(/** @type {S/**/} */) {}

verify.completions({
    marker: "",
    includes: "SomeNumber",
});

๐Ÿ™ Actual behavior

See above, completions are missing.

๐Ÿ™‚ Expected behavior

See above, completions are present.

Additional information about the issue

No response

Contributor guide

JSDoc @type completion not working inside function argument ยท Microsoft/TypeScript#62281 | Good First Issue