I am trying to create a type that represents a UUID in TypeScript. I'm new to TS but found this post that describes how to make a similar solution. However, when I use four (three is fine) of the same type, it causes this error. I can't find any solution because it appears imports or wrong TS versions in VS Code cause most. This is just a simple .ts file and I've already switched my VS Code TS versions from the workspace and vice versa. The code in question is below:
type uuidChar = 'q' | 'w' | 'e' | 'r' | 't' | 'y' | 'u' | 'i' | 'o' | 'p' | 'a' | 's' | 'd' | 'f' | 'g' | 'h' | 'j' | 'k' | 'l' | 'z' | 'x' | 'c' |
'v' | 'b' | 'n' | 'm' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '0';
type uuid = `${uuidChar}-${uuidChar}-${uuidChar}-${uuidChar}`
I want to make a type for an object field that represents a UUID from the crypto library and I couldn't find any types already made.
Thank you in advance!