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
Oh yeah, that's a non-trivial fix. This project was created before template literal types were a thing. We'd need some sort of regex validator to do it properly, but for now falling back to a regular string check and logging an error would be best.
After researching this, I don't think a complex validator is necessary. All template strings are always string in the typeof key word. Even if the values are null, undefined, numbers, objects, etc. in the template string itself.
I think it is safe to set the logic to the following:
"If a template string is detected, validate the stored type is a string."
I think validating the content of the string would be where the regex is necessary, the object type (contain of the string content) will always be string though.
As soon as you use a "wildcard" in a template literal string like
`${string}`
, the generator breaks down.For example, if you have an email type like this:
the generated typeguard looks like this:
and that don't work as the
typeof obj
would be"string"
.The text was updated successfully, but these errors were encountered: