Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Type error reported by @typescript-eslint/no-unsafe-return #10

Closed
Labels
👀 no/externalThis makes more sense somewhere else 👎 phase/noPost cannot or will not be acted on
@karlhorky

Description

Initial checklist

Affected package

hast-util-to-jsx-runtime@2.3.2

Steps to reproduce

  1. Configure @typescript-eslint/no-unsafe-return rule in some Node.js or Next.js project (eg. Next.js App Router project)
  2. Add Shiki example code for hast-util-to-jsx-runtime in components/CodeBlock.tsx
  3. 💥 Observe "Unsafe return of a value of type error" error with return value

Reproduction (typescript-eslint Playground)

Unsafe return of a value of type error. 12:3 - 20:6

Screenshot 2024年12月06日 at 15 11 13

Using a as JSX.element type assertion on the return value of toJsxRuntime() is a workaround for the issue:

Screenshot 2024年12月06日 at 15 11 26

Actual behavior

Error with a "type error". The type error is not observable.

Expected behavior

No error

Runtime

node@22.11.0

Package manager

yarn@1.22.22

Operating system

macOS Sequoia 15.1.1

Build and bundle tools

other (please specify in steps to reproduce)

Metadata

Metadata

Assignees

No one assigned

    Labels

    👀 no/externalThis makes more sense somewhere else 👎 phase/noPost cannot or will not be acted on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /