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

jsx-runtime types missing? #239

Open
jcayzac opened this issue Feb 26, 2021 · 3 comments
Open

jsx-runtime types missing? #239

jcayzac opened this issue Feb 26, 2021 · 3 comments

Comments

@jcayzac
Copy link

jcayzac commented Feb 26, 2021

When using "jsxImportSource": "fre" in my typescript project I'm getting:

Could not find a declaration file for module 'fre/jsx-runtime'. 'node_modules/.pnpm/[email protected]/node_modules/fre/jsx-runtime.js' implicitly has an 'any' type.
@yisar
Copy link
Collaborator

yisar commented Feb 26, 2021

Indeed, there is no type file to write this file. If you can't wait, you can do a pr?

@jcayzac
Copy link
Author

jcayzac commented Feb 26, 2021

Not sure how to add it to the package without refactoring exports. I added that into my project and it fixed a few things:

/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/ban-types */
declare module 'fre/jsx-runtime' {
  import { Attributes, FC, IFiber } from 'fre'

  type _JSX = <P extends Attributes = {}>(
    type: FC<P>,
    attrs: P
  ) => Partial<IFiber>

  export const jsx: _JSX
  export const jsxs: _JSX
  export function Fragment(props: any): any
}

@yisar
Copy link
Collaborator

yisar commented Jun 27, 2021

Not sure how to add it to the package without refactoring exports. I added that into my project and it fixed a few things:

/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/ban-types */
declare module 'fre/jsx-runtime' {
  import { Attributes, FC, IFiber } from 'fre'

  type _JSX = <P extends Attributes = {}>(
    type: FC<P>,
    attrs: P
  ) => Partial<IFiber>

  export const jsx: _JSX
  export const jsxs: _JSX
  export function Fragment(props: any): any
}

Can you pull a PR and put a d.ts file with the same name in the root directory?

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