diff --git a/index.js b/index.js index e5bd801..5a3e680 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ /** - * @typedef {import('./lib/index.js').Options} Options + * @typedef {import('./lib/parse-argv.js').Options} Options */ export {args} from './lib/index.js' diff --git a/lib/index.js b/lib/index.js index 599a806..3455fcb 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,9 +1,7 @@ /** - * @typedef {import('unified-engine').Callback} EngineCallback - * @typedef {import('unified-engine').Context} EngineContext - * - * @typedef {import('./parse-argv.js').Options} Options - * @typedef {import('./parse-argv.js').State} State + * @import {Options} from 'unified-args' + * @import {Callback as EngineCallback, Context as EngineContext} from 'unified-engine' + * @import {State} from './parse-argv.js' */ import process from 'node:process' diff --git a/lib/parse-argv.js b/lib/parse-argv.js index f60b1aa..17b2f44 100644 --- a/lib/parse-argv.js +++ b/lib/parse-argv.js @@ -1,8 +1,6 @@ /** - * @typedef {import('unified-engine').Options} EngineOptions - * @typedef {import('unified-engine').Preset} Preset - * - * @typedef {import('./schema.js').Field} Field + * @import {Options as EngineOptions, Preset} from 'unified-engine' + * @import {Field} from './schema.js' */ /** diff --git a/test/fixtures/plugins/plugin.js b/test/fixtures/plugins/plugin.js index b89adbf..f718de5 100644 --- a/test/fixtures/plugins/plugin.js +++ b/test/fixtures/plugins/plugin.js @@ -1,4 +1,8 @@ -/** @type {import('unified').Plugin<[unknown?]>} */ +/** + * @import {Plugin} from 'unified' + */ + +/** @type {Plugin<[unknown?]>} */ export default function plugin(options) { console.log(JSON.stringify(options)) } diff --git a/test/fixtures/processor.js b/test/fixtures/processor.js index 1ad9099..438ddbf 100644 --- a/test/fixtures/processor.js +++ b/test/fixtures/processor.js @@ -1,16 +1,16 @@ /** - * @typedef {import('unist').Literal} Literal - * @typedef {import('unist').Node} Node + * @import {Compiler, Parser, Plugin} from 'unified' + * @import {Literal, Node} from 'unist' */ import {unified} from 'unified' export const processor = unified() .use( - /** @type {import('unified').Plugin<[], string, Node>} */ + /** @type {Plugin<[], string, Node>} */ // @ts-expect-error: TS is wrong about `this`. function () { - /** @type {import('unified').Parser} */ + /** @type {Parser} */ this.parser = function (value) { /** @type {Literal} */ const node = {type: 'text', value} @@ -19,10 +19,10 @@ export const processor = unified() } ) .use( - /** @type {import('unified').Plugin<[], Node, string>} */ + /** @type {Plugin<[], Node, string>} */ // @ts-expect-error: TS is wrong about `this`. function () { - /** @type {import('unified').Compiler} */ + /** @type {Compiler} */ this.compiler = function (tree) { const node = /** @type {Literal} */ (tree) return String(node.value) diff --git a/test/index.js b/test/index.js index c69845e..82d3fdf 100644 --- a/test/index.js +++ b/test/index.js @@ -1,5 +1,5 @@ /** - * @typedef {import('execa').ExecaError} ExecaError + * @import {ExecaError} from 'execa' */ import assert from 'node:assert/strict'