Protected
Optional
sortedLowest specificality first
Registers a new template and replaces all existing (added via register,prepend,append).
Specificality defines when the given template guard is executed.
1 means its used for JS types - exact types. For example for type string 'string' ==== typeof v
is used. Same for number, bigint, and boolean.
Guards of this specificality are used for the is()
function.
1 means it acts as a fallback. For example in a union
number | Date
, when a string is given, the Date can allowstring
type as well, so it gets converted to a Date.
0 && <1 means its acts as a priority guard. For example in a
string | Date
, a string of date-format is converted to a Date instead of a string. This is necessary to support regular JSON.
<0, anything below 0 means it can optionally be used for loosely types. This is handy when data comes from a string-only encoding like URL query strings. In this specificality a numeric string is converted to a number or bigint, a 1|0|true|false string converted to boolean .
Generated using TypeDoc
See
register() for specificality explanation.