Eh, CSS is inherently typed. My only concern is, why specify types in attr() and not just infer them (like the rest of CSS does)?
min-width: attr(foo) /* implicitly requires type to be length */
color: attr(bar) /* implicitly requires type to be color */
Unless you wanted to use a shorthand property like border, but restrict the attribute to only one part of it? border: 1px attr(bdrcolor type(<color>)) /* needs explicit type to prevent specifying border-style */
But that would be easier and cleaner to specify separately? border-width: 1px
border-color: attr(bdrcolor) /* implicitly requires type to be color */
In what scenarios does adding the explicit type information help, rather than having the parser infer the type of the attr() based on the context of the call?CSS variables are another thing to consider perhaps. You can specify their type explicitly as well (albeit using a more verbose syntax):
@property --logo-color {
syntax: "<color>";
inherits: false;
initial-value: attr(logo-color);
}