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

Module '"hono/jsx"' declares 'FC' locally, but it is not exported.ts #2568

Open
dcsan opened this issue Apr 28, 2024 · 1 comment
Open

Module '"hono/jsx"' declares 'FC' locally, but it is not exported.ts #2568

dcsan opened this issue Apr 28, 2024 · 1 comment

Comments

@dcsan
Copy link

dcsan commented Apr 28, 2024

What version of Hono are you using?

2.7.8

What runtime/platform is your app running on?

cloudflare workers or just plain node - same

What steps can reproduce the bug?

as per this guide:
https://hono.dev/guides/jsx#jsx

try to create a JSX module and add the line:

import type { FC } from 'hono/jsx'

will give compiler error:

Module '"hono/jsx"' declares 'FC' locally, but it is not exported.ts(2459)

What is the expected behavior?

should be able to create JSX modules

What do you see instead?

> knowbase-api@0.0.1 run
> node --watch -r ts-node/register src/index.ts

(node:13184) ExperimentalWarning: Watch mode is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
/Users/dc/dev/hacks/kbxt/workers/node_modules/ts-node/src/index.ts:859
    return new TSError(diagnosticText, diagnosticCodes, diagnostics);
           ^
TSError: ⨯ Unable to compile TypeScript:
src/api/home.tsx:2:15 - error TS2459: Module '"hono/jsx"' declares 'FC' locally, but it is not exported.

2 import type { FC } from 'hono/jsx'
                ~~

  node_modules/hono/dist/types/middleware/jsx/index.d.ts:22:14
    22 declare type FC<T = Props> = (props: T) => HtmlEscapedString;
                    ~~
    'FC' is declared here.

    at createTSError (/Users/dc/dev/hacks/kbxt/workers/node_modules/ts-node/src/index.ts:859:12)
    at reportTSError (/Users/dc/dev/hacks/kbxt/workers/node_modules/ts-node/src/index.ts:863:19)
    at getOutput (/Users/dc/dev/hacks/kbxt/workers/node_modules/ts-node/src/index.ts:1077:36)
    at Object.compile (/Users/dc/dev/hacks/kbxt/workers/node_modules/ts-node/src/index.ts:1433:41)
    at Module.m._compile (/Users/dc/dev/hacks/kbxt/workers/node_modules/ts-node/src/index.ts:1617:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.require.extensions.<computed> [as .tsx] (/Users/dc/dev/hacks/kbxt/workers/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19) {
  diagnosticCodes: [ 2459 ]
}
Failed running 'src/index.ts'

Additional information

and in the file in question:

it is indeed just declared and not exported:

node_modules/hono/dist/types/middleware/jsx/index.d.ts

declare type FC<T = Props> = (props: T) => HtmlEscapedString;

@dcsan dcsan added the bug label Apr 28, 2024
@yusukebe
Copy link
Member

FC is no longer used for the user. Please use PropsWithChildren instead of it.

https://hono.dev/guides/jsx#propswithchildren

Ref: #2142

@yusukebe yusukebe removed the bug label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants