typst-community / valkyrie

Type safe type safety for Typst
Other
30 stars 3 forks source link

Add types and coercions for "variable" types like stroke and fill #30

Open jneug opened 4 months ago

jneug commented 4 months ago

18 added a schema for the Typst builtin type "stroke". But most of the time stroke arguments accept either one of stroke, length, color or dict. Similarly fill usually accepts color, gradient or pattern.

There should be types to support this, since those are very common use-cases in Typst.

I suggest these compound types:

I probably missed some.

jamesrswift commented 4 months ago

A lot of these will be getting coercions in a future update. Most likely it will be in the form of additionally accepted types followed by a default post-transform.

Will keep this open to track.

jamesrswift commented 4 months ago

Regarding inset and other such things, these would make for a good addition as a schema rather than a type (see schema folder for examples)