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
I recently wanted to add a data- attribute to the <link> tag for a set of stylesheets in the shinyswatch HTMLDependency. I was pleased that stylesheet implementation lets me pass arbitrary attributes, but I had to disable type checking for the input.
I also noticed that the presence of these types did not lead to any hints in the IDE, just type errors when checked. That might be a configuration issue on my end, or it might signal that the type annotation isn't as useful as expected.
Personally, I think the TagAttrValues type would balance flexibility and type checking.
The text was updated successfully, but these errors were encountered:
One of the useful things about the typed dictionaries is that they will tell you if you're missing a required field. The non-required fields can be useful for autocompletion.
(An aside: I can't remember why they're built the way they are, by combining two TypedDicts, one with required fields and one with non-required fields, instead of a single TypedDict with NotRequired for some of the fields. Perhaps this code was written before NotRequired was available?)
I appreciate the effort in this type (and the one for script objects as well), but I think it might be overly limiting.
py-htmltools/htmltools/_core.py
Lines 1322 to 1341 in a3a9825
I recently wanted to add a
data-
attribute to the<link>
tag for a set of stylesheets in the shinyswatchHTMLDependency
. I was pleased that stylesheet implementation lets me pass arbitrary attributes, but I had to disable type checking for the input.I also noticed that the presence of these types did not lead to any hints in the IDE, just type errors when checked. That might be a configuration issue on my end, or it might signal that the type annotation isn't as useful as expected.
Personally, I think the
TagAttrValues
type would balance flexibility and type checking.The text was updated successfully, but these errors were encountered: