| ▲ | trekz 2 days ago | ||||||||||||||||||||||||||||||||||||||||
> If you have a large enough codebase, you'll likely find a few cases where things work in TypeScript but its equivalent somehow fails type check in JSDoc. You keep repeating this throughout the thread. Can you give an example? | |||||||||||||||||||||||||||||||||||||||||
| ▲ | spartanatreyu a day ago | parent | next [-] | ||||||||||||||||||||||||||||||||||||||||
Not that person, but is there an easy way to write something like a basic semver? export type SemVer = `${number}.${number}.${number}`; Could you extend it to work with regex groups like: export const SemVerRegex = /^(?<major>0|[1-9]\d)\.(?<minor>0|[1-9]\d)\.(?<patch>0|[1-9]\d)(?:-((?:0|[1-9]\d|\d[a-zA-Z-][0-9a-zA-Z-])(?:\.(?:0|[1-9]\d|\d[a-zA-Z-][0-9a-zA-Z-]))))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/; Could the groups be extracted so you the type back if you ran the regex on a string like: "1.2.3", or "1.2.3-prerelease"? | |||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||
| ▲ | g947o 2 days ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||||||||