You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is to be discussed of course but I wonder whether it makes sense to add none to the type union e.types.paint. I think virtually everywhere in the Typst standard library, the parameter fill accepts none | color | gradient | pattern/tiling.
This makes it easier to declare fields that are to be used with native primitives like box, rect, grid, etc.
Edit: Note that stroke.paint does not accept none, however.
The text was updated successfully, but these errors were encountered:
I had a similar thought regarding content vs option(content), but ultimately it all seems to have the same pattern; we'd end up adding none to more types than we need, I think.
Yeah, stroke was my main inspiration here. I think having to write types.option(types.paint) would be fairly acceptable in such cases.
Okay, fair point, although I think that it's the more common case that a fill also accepts none.
I had a similar thought regarding content vs option(content), but ultimately it all seems to have the same pattern; we'd end up adding none to more types than we need, I think.
However, none implicitly casts to content in Typst in most cases, right? As an example grid, highlight and all other functions that take content also take none (although not explicitly annotated in the docs). I feel like none is just some valid content.
This is to be discussed of course but I wonder whether it makes sense to add
none
to the type unione.types.paint
. I think virtually everywhere in the Typst standard library, the parameterfill
acceptsnone | color | gradient | pattern/tiling
.This makes it easier to declare fields that are to be used with native primitives like
box
,rect
,grid
, etc.Edit: Note that
stroke.paint
does not acceptnone
, however.The text was updated successfully, but these errors were encountered: