Skip to content

Commit 4fe79e6

Browse files
committed
Refactor to use @imports
1 parent 6a16a9b commit 4fe79e6

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* @typedef {import('./lib/index.js').Space} Space
32
* @typedef {import('./lib/index.js').Options} Options
3+
* @typedef {import('./lib/index.js').Space} Space
44
*/
55

66
export {fromSelector} from './lib/index.js'

lib/index.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
/**
2-
* @typedef {import('css-selector-parser').AstAttribute} AstAttribute
3-
* @typedef {import('css-selector-parser').AstRule} AstRule
4-
*
5-
* @typedef {import('hast').Element} HastElement
6-
* @typedef {import('hast').Properties} HastProperties
2+
* @import {AstAttribute, AstRule} from 'css-selector-parser'
3+
* @import {Element, Properties} from 'hast'
74
*/
85

96
/**
107
* @typedef Options
118
* Configuration.
12-
* @property {Space} [space]
9+
* @property {Space | null | undefined} [space]
1310
* Which space first element in the selector is in (default: `'html'`).
1411
*
1512
* When an `svg` element is created in HTML, the space is automatically
@@ -40,7 +37,7 @@ const emptyOptions = {}
4037
* CSS selector (default: `''`).
4138
* @param {Options | null | undefined} [options]
4239
* Configuration (optional).
43-
* @returns {HastElement}
40+
* @returns {Element}
4441
* Built tree.
4542
*/
4643
export function fromSelector(selector, options) {
@@ -78,7 +75,7 @@ export function fromSelector(selector, options) {
7875
* Selector.
7976
* @param {State} state
8077
* Info on current context.
81-
* @returns {Array<HastElement>}
78+
* @returns {Array<Element>}
8279
* One or more elements.
8380
*/
8481
function rule(query, state) {
@@ -138,11 +135,11 @@ function rule(query, state) {
138135
*
139136
* @param {Array<AstAttribute> | undefined} attributes
140137
* Attribute selectors.
141-
* @returns {HastProperties}
138+
* @returns {Properties}
142139
* Properties.
143140
*/
144141
function attributesToHast(attributes) {
145-
/** @type {HastProperties} */
142+
/** @type {Properties} */
146143
const properties = {}
147144
let index = -1
148145

0 commit comments

Comments
 (0)