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

Readme example has type error #17

Closed
4 tasks done
nvlang opened this issue Jun 15, 2024 · 3 comments
Closed
4 tasks done

Readme example has type error #17

nvlang opened this issue Jun 15, 2024 · 3 comments
Labels
👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on

Comments

@nvlang
Copy link

nvlang commented Jun 15, 2024

Initial checklist

Affected packages and versions

[email protected]

Link to runnable example

https://stackblitz.com/edit/github-8eeglc?file=src%2Fmain.ts

Steps to reproduce

  1. Go to minimal reproduction
  2. Run tsc

Expected behavior

No type errors.

Actual behavior

The following error is logged:

src/main.ts:12:22 - error TS2345: Argument of type '[Processor<Root, Root, undefined, undefined, undefined>]' is not assignable to parameter of type '[boolean] | [parser: Parser, options?: Options | null | undefined]'.
  Type '[Processor<Root, Root, undefined, undefined, undefined>]' is not assignable to type '[boolean]'.
    Type 'Processor<Root, Root, undefined, undefined, undefined>' is not assignable to type 'boolean'.

12   .use(remarkRetext, unified().use(retextEnglish).use(retextEquality))

Runtime

No response

Package manager

No response

OS

No response

Build and bundle tools

No response

@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 Jun 15, 2024
@ChristianMurphy
Copy link
Member

TypeScript isn't capable of inferring this type yet.
Add an // @ts-expect-error annotation.

remark-retext/test.js

Lines 38 to 39 in 4395bc6

// @ts-expect-error: TS barfs on overloads that result in bridges.
.use(remarkRetext, unified().use(retextEnglish))

If there has been a recent improvement to TS which would enable this, feel free to share an example of that working.

@ChristianMurphy ChristianMurphy closed this as not planned Won't fix, can't repro, duplicate, stale Jun 15, 2024
@ChristianMurphy ChristianMurphy added the 👀 no/external This makes more sense somewhere else label Jun 15, 2024

This comment has been minimized.

@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 Jun 15, 2024
@wooorm
Copy link
Member

wooorm commented Jun 17, 2024

Looked into it again — Doesn’t seem anything changed in TS to support both the overloads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

3 participants