Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript error when doing simple unified markdown pipeline #229

Closed
4 tasks done
pudo opened this issue Aug 25, 2023 · 3 comments
Closed
4 tasks done

TypeScript error when doing simple unified markdown pipeline #229

pudo opened this issue Aug 25, 2023 · 3 comments
Labels
👯 no/duplicate Déjà vu 👎 phase/no Post cannot or will not be acted on

Comments

@pudo
Copy link

pudo commented Aug 25, 2023

Initial checklist

Affected packages and versions

unified 11.0

Link to runnable example

https://github.com/opensanctions/site/blob/main/lib/util.tsx#L11-L20

Steps to reproduce

I'm trying to just build a string of markdown into some HTML using TypeScript and unified. When attempting to upgrade from unified 10 to 11, the very simple call syntax present in the README file of this project is rejected because of type inconsistencies. All the other dependencies are up to date, so I'm a curious if there may be a need to updated the usage as per README?

Expected behavior

The same pipeline works flawlessly using unified 10.

Actual behavior

./lib/util.tsx:13:10
Type error: No overload matches this call.
  Overload 1 of 3, '(preset?: Preset | null | undefined): Processor<undefined, undefined, undefined, undefined, undefined>', gave the following error.
    Type 'Plugin<[(Options | undefined)?], string, Root>' has no properties in common with type 'Preset'.
  Overload 2 of 3, '(list: PluggableList): Processor<undefined, undefined, undefined, undefined, undefined>', gave the following error.
    Argument of type 'Plugin<[(Options | undefined)?], string, Root>' is not assignable to parameter of type 'PluggableList'.
  Overload 3 of 3, '(plugin: Plugin<[], undefined, undefined>, ...parameters: [] | [boolean]): Processor<undefined, undefined, undefined, undefined, undefined>', gave the following error.
    Argument of type 'Plugin<[(Options | undefined)?], string, Root>' is not assignable to parameter of type 'Plugin<[], undefined, undefined>'.
      The 'this' types of each signature are incompatible.
        Type 'Processor<undefined, undefined, undefined, undefined, undefined>' is not assignable to type 'Processor<Root, Root, void, void>'.
          Types of property 'use' are incompatible.
            Type '{ <Parameters_2 extends unknown[] = [], Input extends string | Node | undefined = undefined, Output = Input>(preset?: Preset | null | undefined): Processor<undefined, undefined, undefined, undefined, undefined>; <Parameters_2 extends unknown[] = [], Input extends string | ... 1 more ... | undefined = undefined, Outp...' is not assignable to type '{ <PluginParameters extends any[] = any[], Input = Root, Output = Input>(plugin: Plugin<PluginParameters, Input, Output>, ...settings: [boolean] | PluginParameters): UsePlugin<...>; <PluginParameters extends any[] = any[], Input = Root, Output = Input>(tuple: [...] | [...]): UsePlugin<...>; (presetOrList: Preset | P...'.
              Types of parameters 'preset' and 'plugin' are incompatible.
                Type 'Plugin<any, any, any>' has no properties in common with type 'Preset'.

  11 | export function markdownToHtml(markdown: string): string {
  12 |   const result = unified()
> 13 |     .use(remarkParse)
     |          ^
  14 |     .use(remarkRehype, { allowDangerousHtml: true })
  15 |     .use(rehypeRaw)
  16 |     .use(rehypeHighlight)

Affected runtime and version

node@20.4.0

Affected package manager and version

9.7.2

Affected OS and version

No response

Build and bundle tools

Next.js

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Aug 25, 2023
@remcohaszing
Copy link
Member

Duplicate of #227

@remcohaszing remcohaszing marked this as a duplicate of #227 Aug 25, 2023
@remcohaszing remcohaszing closed this as not planned Won't fix, can't repro, duplicate, stale Aug 25, 2023
@github-actions

This comment has been minimized.

@github-actions
Copy link

Hi! Thanks for taking the time to contribute!

Because we treat issues as our backlog, we close duplicates to focus our work and not have to touch the same chunk of code for the same reason multiple times. This is also why we may mark something as duplicate that isn’t an exact duplicate but is closely related.

Thanks,
— bb

@github-actions github-actions bot added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👯 no/duplicate Déjà vu 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

2 participants