diff --git a/lib/handle/comment.js b/lib/handle/comment.js index 95ff4aa..3a49064 100644 --- a/lib/handle/comment.js +++ b/lib/handle/comment.js @@ -1,8 +1,6 @@ /** - * @typedef {import('hast').Comment} Comment - * @typedef {import('hast').Parents} Parents - * - * @typedef {import('../index.js').State} State + * @import {Comment, Parents} from 'hast' + * @import {State} from '../index.js' */ import {stringifyEntities} from 'stringify-entities' diff --git a/lib/handle/doctype.js b/lib/handle/doctype.js index d2b9c4a..36b43ad 100644 --- a/lib/handle/doctype.js +++ b/lib/handle/doctype.js @@ -1,13 +1,8 @@ /** - * @typedef {import('hast').Doctype} Doctype - * @typedef {import('hast').Parents} Parents - * - * @typedef {import('../index.js').State} State + * @import {Doctype, Parents} from 'hast' + * @import {State} from '../index.js' */ -// Make VS code see references to the above types. -'' - /** * Serialize a doctype. * diff --git a/lib/handle/element.js b/lib/handle/element.js index 217f105..17b4713 100644 --- a/lib/handle/element.js +++ b/lib/handle/element.js @@ -1,9 +1,6 @@ /** - * @typedef {import('hast').Element} Element - * @typedef {import('hast').Parents} Parents - * @typedef {import('hast').Properties} Properties - * - * @typedef {import('../index.js').State} State + * @import {Element, Parents, Properties} from 'hast' + * @import {State} from '../index.js' */ import {ccount} from 'ccount' diff --git a/lib/handle/index.js b/lib/handle/index.js index e861c01..31401e1 100644 --- a/lib/handle/index.js +++ b/lib/handle/index.js @@ -1,8 +1,6 @@ /** - * @typedef {import('hast').Nodes} Nodes - * @typedef {import('hast').Parents} Parents - * - * @typedef {import('../index.js').State} State + * @import {Nodes, Parents} from 'hast' + * @import {State} from '../index.js' */ import {zwitch} from 'zwitch' diff --git a/lib/handle/raw.js b/lib/handle/raw.js index 6c89a11..834ab92 100644 --- a/lib/handle/raw.js +++ b/lib/handle/raw.js @@ -1,9 +1,7 @@ /** - * @typedef {import('hast').Parents} Parents - * - * @typedef {import('mdast-util-to-hast').Raw} Raw - * - * @typedef {import('../index.js').State} State + * @import {Parents} from 'hast' + * @import {Raw} from 'mdast-util-to-hast' + * @import {State} from '../index.js' */ import {text} from './text.js' diff --git a/lib/handle/root.js b/lib/handle/root.js index ccd84e1..97ef35b 100644 --- a/lib/handle/root.js +++ b/lib/handle/root.js @@ -1,13 +1,8 @@ /** - * @typedef {import('hast').Parents} Parents - * @typedef {import('hast').Root} Root - * - * @typedef {import('../index.js').State} State + * @import {Parents, Root} from 'hast' + * @import {State} from '../index.js' */ -// Make VS code see references to the above types. -'' - /** * Serialize a root. * diff --git a/lib/handle/text.js b/lib/handle/text.js index af08b28..03cefde 100644 --- a/lib/handle/text.js +++ b/lib/handle/text.js @@ -1,10 +1,7 @@ /** - * @typedef {import('hast').Parents} Parents - * @typedef {import('hast').Text} Text - * - * @typedef {import('mdast-util-to-hast').Raw} Raw - * - * @typedef {import('../index.js').State} State + * @import {Parents, Text} from 'hast' + * @import {Raw} from 'mdast-util-to-hast' + * @import {State} from '../index.js' */ import {stringifyEntities} from 'stringify-entities' diff --git a/lib/index.js b/lib/index.js index 93bb730..05da5b5 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,11 +1,7 @@ /** - * @typedef {import('hast').Nodes} Nodes - * @typedef {import('hast').Parents} Parents - * @typedef {import('hast').RootContent} RootContent - * - * @typedef {import('property-information').Schema} Schema - * - * @typedef {import('stringify-entities').Options} StringifyEntitiesOptions + * @import {Nodes, Parents, RootContent} from 'hast' + * @import {Schema} from 'property-information' + * @import {Options as StringifyEntitiesOptions} from 'stringify-entities' */ /** @@ -77,10 +73,10 @@ * Leave attributes unquoted if that results in less bytes (default: `false`). * * Not used in the SVG space. - * @property {Quote | null | undefined} [quote='"'] - * Preferred quote to use (default: `'"'`). * @property {boolean | null | undefined} [quoteSmart=false] * Use the other quote if that results in less bytes (default: `false`). + * @property {Quote | null | undefined} [quote='"'] + * Preferred quote to use (default: `'"'`). * @property {Space | null | undefined} [space='html'] * When an `` element is found in the HTML space, this package already * automatically switches to and from the SVG space when entering and exiting @@ -138,18 +134,18 @@ * * @typedef State * Info passed around about the current state. - * @property {(node: Nodes, index: number | undefined, parent: Parents | undefined) => string} one - * Serialize one node. * @property {(node: Parents | undefined) => string} all * Serialize the children of a parent node. - * @property {Settings} settings - * User configuration. - * @property {Schema} schema - * Current schema. - * @property {Quote} quote - * Preferred quote. * @property {Quote} alternative * Alternative quote. + * @property {(node: Nodes, index: number | undefined, parent: Parents | undefined) => string} one + * Serialize one node. + * @property {Quote} quote + * Preferred quote. + * @property {Schema} schema + * Current schema. + * @property {Settings} settings + * User configuration. */ import {htmlVoidElements} from 'html-void-elements' diff --git a/lib/omission/closing.js b/lib/omission/closing.js index a7cd1a1..b30baf7 100644 --- a/lib/omission/closing.js +++ b/lib/omission/closing.js @@ -1,6 +1,5 @@ /** - * @typedef {import('hast').Element} Element - * @typedef {import('hast').Parents} Parents + * @import {Element, Parents} from 'hast' */ import {whitespace} from 'hast-util-whitespace' diff --git a/lib/omission/omission.js b/lib/omission/omission.js index 692101c..902f38f 100644 --- a/lib/omission/omission.js +++ b/lib/omission/omission.js @@ -1,6 +1,5 @@ /** - * @typedef {import('hast').Element} Element - * @typedef {import('hast').Parents} Parents + * @import {Element, Parents} from 'hast' */ /** diff --git a/lib/omission/opening.js b/lib/omission/opening.js index 65c9964..edc878c 100644 --- a/lib/omission/opening.js +++ b/lib/omission/opening.js @@ -1,6 +1,5 @@ /** - * @typedef {import('hast').Element} Element - * @typedef {import('hast').Parents} Parents + * @import {Element, Parents} from 'hast' */ import {whitespace} from 'hast-util-whitespace' diff --git a/lib/omission/util/siblings.js b/lib/omission/util/siblings.js index c686a17..09edae4 100644 --- a/lib/omission/util/siblings.js +++ b/lib/omission/util/siblings.js @@ -1,6 +1,5 @@ /** - * @typedef {import('hast').Parents} Parents - * @typedef {import('hast').RootContent} RootContent + * @import {Parents, RootContent} from 'hast' */ import {whitespace} from 'hast-util-whitespace' diff --git a/test/raw.js b/test/raw.js index 77c1d0d..6b586f5 100644 --- a/test/raw.js +++ b/test/raw.js @@ -1,5 +1,5 @@ /** - * @typedef {import('mdast-util-to-hast')} DoNotTouchThisRegistersRawInTheTree + * @import {} from 'mdast-util-to-hast' */ import assert from 'node:assert/strict'