the-draupnir-project / Draupnir

A Matrix moderation bot
https://the-draupnir-project.github.io/draupnir-documentation/
Academic Free License v3.0
68 stars 13 forks source link

TypeCheck JSX expressions, children, and attributes ^-^ #454

Closed Gnuxie closed 3 weeks ago

Gnuxie commented 3 weeks ago

Awesome.

The documentation was not very explicit, I had to play around a lot to figure it out but I'm so happy that this works. https://www.typescriptlang.org/docs/handbook/jsx.html.

Please note that undefined as a child will not be caught yet, as we need to enable exactOptionalPropertyTypes for this to work.

Gnuxie commented 3 weeks ago

https://github.com/the-draupnir-project/Draupnir/issues/453 https://github.com/the-draupnir-project/Draupnir/issues/452

Gnuxie commented 3 weeks ago

Hmmm we could possibly use https://github.com/microsoft/TypeScript/blob/main/src/lib/dom.generated.d.ts

Gnuxie commented 3 weeks ago

We might be able to avoid declare global if we can try import the entire module in each tsx file and not just JSXFactory.