Skip to content

Dictionary type errors #96

Answered by ChristianMurphy
The1029 asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks @The1029!
A couple issues

  1. there seems to be a mismatch between the dictionary type in retext-spell and dictionaries.
    TypeScript highlighted this, but JS fails as you described.
  2. unified().process() is a promise and needs to be awaited.

To use the versions of dictionary-en-gb and retext-spell from you package json, use the following snippet.

import { unified } from 'unified';
import retextEnglish from 'retext-english';
import retextSpell from 'retext-spell';
import retextStringify from 'retext-stringify';
import enGb from 'dictionary-en-gb';

const message = await unified()
  .use(retextEnglish)
  .use(retextSpell, { dictionary: (onload) => onload(null, enGb) })
  .use(retextStringify

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@The1029
Comment options

@ChristianMurphy
Comment options

Answer selected by The1029
@The1029
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants