anysphere / priompt

Prompt design using JSX.
MIT License
849 stars 51 forks source link

Create props type per intrinsic element #3

Closed unknown closed 8 months ago

unknown commented 8 months ago

The BaseProps type is currently used to create the prop types of intrinsic elements. However, this is hard to read/understand and requires careful usage of the Omit utility type.

This PR creates unique prop types per intrinsic element that are (hopefully) easier to understand and maintain. This also fixes the types so that only <first> and <scope> elements can pass in onEject and onInclude.

I also chose to combine the tokens prop with tokenLimit of the <empty> element to just tokens, which required a slight change to lib.ts, so I added a new test for good measure.