Open miyaji255 opened 1 month ago
Unfortunately, template literal string type cannot utilize type tags.
It's because TypeScript compiler API cannot recognize the intersection tag type in the template literal type.
That's unfortunate. Since typia.random<intStr>()
was outputting correctly, I thought it could be obtained. Is there a way to treat strings without other characters (for example, `${boolean}`
, `${number & tags.Type<"int32">}`
) as a special case?
@samchon I found that ts compiler can handle the intersection tag type in the template literal since v5.1! TS5.1
The interesting thing is that anoter library ts-runtime-checks has the same issue
@miyaji255 Good point, will you challenge this issue?
Sorry, it's hard for me to do.
Bug Report
📝 Summary
`${number & tags.Type<"int32">}`
passes decimal string (such as"0.1"
)"1"
)"0.1"
)⏯ Playground Link
https://typia.io/playground/?script=JYWwDg9gTgLgBDAnmYBDANHA3g1BzAZzgF84AzKCEOAIiRVRoG4AoF+gUzmADsYBlGFDgBeOAAMAJFh4BXEACMOwgGS5CAOgAqyDgB4avGAGYATDQB8xcWwDGEHgXgA3VABs4ohMjQaoqHgATKj0jQSgLAAoASiY4AHp42gAGGkwaAEYaOA1clntHeFsACw5bAGsMr3pfYAJQvnComlTYhKShWQ58hyc4ErLy02qfVA06hoEhZuSNLLbEhCguuD0xACFZPDgAQh27Xog3Dg03CDxIrBZPVzd0a-7Sioz7zwGK0xZiNpYgA
💻 Code occuring the bug