elysiajs / elysia-html

A plugin for Elysia that add support for returning html
MIT License
25 stars 18 forks source link

No exported PropsWithChildren type #94

Open jacopo-trompeo opened 3 months ago

jacopo-trompeo commented 3 months ago

I'm trying to define a layout that takes in some children, but it doesn't look like the library exports a type for it.

Here's the index.d.ts for @elysiajs/html version ^1.1.0

import { createElement } from './h'; 
export * from './html';
export * from './options';
export * from './utils';
export { ErrorBoundary } from '@kitajs/html/error-boundary';
export { Html } from '@kitajs/html';
export { createElement };
export { html as default } from './html';

I saw some examples saying I should use Html.Children or Html.PropsWithChildren, but those are not properties in my Html object. I do however see that kitajs exports a PropsWithChildren type that is not being exposed by the elysia html library.

Can anyone tell me if I'm maybe doing something wrong?

Thanks

Nmans01 commented 3 months ago

At some point, the developer of KitaJS/Html separated some types out of the Html namespace. Among these were Children and PropsWithChildren. The consequence of this is that Elysia/Html no longer includes these types implicitly. To solve the issue, perhaps

export { Html } from '@kitajs/html';

can be changed to

export * from '@kitajs/html';