jsx-runtime types missing?
jcayzac opened this issue · comments
Julien Cayzac commented
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/fre@2.0.0/node_modules/fre/jsx-runtime.js' implicitly has an 'any' type.
伊撒尔 commented
Indeed, there is no type file to write this file. If you can't wait, you can do a pr?
Julien Cayzac commented
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
}
伊撒尔 commented
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?