diff --git a/index.js b/index.js index 364520a..ac0db15 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,7 @@ /** + * @typedef {import('nlcst').Root} Root + * @typedef {import('nlcst').Sentence} Sentence + * * @typedef Options * Configuration. * @property {boolean} [allowLiterals=false] @@ -24,14 +27,15 @@ const data = initialize() /** * Plugin to check contractions use. * - * @type {import('unified').Plugin<[Options?]>} + * @type {import('unified').Plugin<[Options?], Root>} */ export default function retextContractions(options = {}) { const ignore = options.allowLiterals const straight = options.straight return (tree, file) => { - visit(tree, 'WordNode', (node, index, parent) => { + visit(tree, 'WordNode', (node, index, parent_) => { + const parent = /** @type {Sentence} */ (parent_) const actual = toString(node) const normal = actual.replace(/['’]/g, '') diff --git a/package.json b/package.json index 1450397..d403a86 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "list.js" ], "dependencies": { + "@types/nlcst": "^1.0.0", "nlcst-is-literal": "^2.0.0", "nlcst-to-string": "^3.0.0", "unified": "^10.0.0",