TheBejbiborn
TheBejbiborn
DDeno
Created by TheBejbiborn on 8/6/2023 in #help
Declaration merging for external packages
To make this thread more generic for module augumentation (not strictly preact / deno fresh) could you explain how did you get to the preact.createElement.JSX? (for anybody looking for the module augumentation typescript docs: https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation)
8 replies
DDeno
Created by TheBejbiborn on 8/6/2023 in #help
Declaration merging for external packages
Leaving the snippet for anybody who finds this thread:
declare global {
namespace preact.createElement.JSX {
// deno-lint-ignore no-empty-interface
interface HTMLAttributes extends AttributifyAttributes {}
}
}
declare global {
namespace preact.createElement.JSX {
// deno-lint-ignore no-empty-interface
interface HTMLAttributes extends AttributifyAttributes {}
}
}
I keep this in my uno.config.ts for convenience.
8 replies
DDeno
Created by TheBejbiborn on 8/6/2023 in #help
Declaration merging for external packages
Thanks!
8 replies
DDeno
Created by TheBejbiborn on 8/6/2023 in #help
Declaration merging for external packages
That works actually!
8 replies
DDeno
Created by TheBejbiborn on 8/6/2023 in #help
Declaration merging for external packages
I'm not sure if there is a need for any particular setup / repo to test this. It's not even that strictly related to Fresh, I think it's a generic topic (declaration merging with namespaces declared by external packages). I think you can start a new empty Fresh project with deno run -A -r https://fresh.deno.dev and just try to override preact's JSXInternal namespace with anything.
8 replies