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
Template Literal String Types are converted to an array schema. They should, however, be converted to strings with a pattern matching the template literal (or at least to a regular string).
It should, however, at least be converted to this instead:
{
"type": "string"
}
Even better would be if the template literal string is converted to a valid pattern. But this might be rather complex (joining regular expressions from types used within the template literal with the static string).
A temporary workaround is to use the JSDoc annotation @type string, but unfortunately this does not work everywhere (i.e. when the template literal types are being used directly in arrays) due to another bug (see #425).
The text was updated successfully, but these errors were encountered:
ssc-hrep3
changed the title
Template Literal Strings are converted to an array schema instead of a string
Template Literal String Types are converted to an array schema instead of a string
Jun 17, 2021
Related is using a template literal inside a template literal and getting 'TemplateLiteral' only refers to a type, but is being used as a value here. can be fixed by updating.
Template Literal String Types are converted to an array schema. They should, however, be converted to strings with a pattern matching the template literal (or at least to a regular string).
Here is an example of a template literal:
This type is then generated to:
It should, however, at least be converted to this instead:
Even better would be if the template literal string is converted to a valid pattern. But this might be rather complex (joining regular expressions from types used within the template literal with the static string).
A temporary workaround is to use the JSDoc annotation
@type string
, but unfortunately this does not work everywhere (i.e. when the template literal types are being used directly in arrays) due to another bug (see #425).Version:
0.50.1
Schema Generation Settings:
The text was updated successfully, but these errors were encountered: