Skip to content

Commit

Permalink
Use @types/nlcst
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 27, 2021
1 parent 7577931 commit d8055f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/**
* @typedef {import('nlcst').Root} Root
*
* @typedef {import('nlcst-emoticon-modifier')} DoNotTouchAsThisImportIncludesEmoticonsInTree
*
* @typedef Options
* Configuration.
* @property {'encode'|'decode'} [convert]
Expand All @@ -21,8 +25,6 @@ import {gemoji} from 'gemoji'

const own = {}.hasOwnProperty

const type = 'EmoticonNode'

const vs16 = 0xfe_0f

/** @type {Record<string, gemoji[number]>} */
Expand Down Expand Up @@ -59,7 +61,7 @@ init()
/**
* Plugin to support emoji, gemoji, and emoticons.
*
* @type {import('unified').Plugin<[Options?]>}
* @type {import('unified').Plugin<[Options?], Root>}
*/
export default function retextEmoji(options = {}) {
const Parser = this.Parser
Expand Down Expand Up @@ -95,7 +97,7 @@ export default function retextEmoji(options = {}) {
}

return (node) => {
visit(node, type, (/** @type {import('unist').Literal<string>} */ node) => {
visit(node, 'EmoticonNode', (node) => {
const emoji = parse(toString(node))

if (!emoji) return
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"index.js"
],
"dependencies": {
"@types/nlcst": "^1.0.0",
"emoticon": "^4.0.0",
"gemoji": "^7.0.0",
"nlcst-affix-emoticon-modifier": "^2.0.0",
Expand Down

0 comments on commit d8055f0

Please sign in to comment.