3 ms·
I often use that approach but (especially when you're importing from a seperate package) the compiler will sometimes view MyType as just an alias for string and
by jbbe 5y ago
I often use that approach but (especially when you're importing from a seperate package) the compiler will sometimes view MyType as just an alias for string and won't catch typos.
Am I missing something in how to use this?
- Recursing 5y ago`as const` is the important bit there, see this playground link https://www.typescriptlang.org/play?#code/MYewdgzgLgBKlQIICdkEMCeMC8MYG0BGAGgCZiBmAXRjQjnGgG4AoAGwFNY0AuGKDAAcOIAGYMEKdBnxgArgFsARh2Q1cAFiYwA9DpgAxNAEs2EFi3jQYYcAGFGsXETKUqrTrCV8BwsTftHWUUVNRwYLV19ABEQDggwAHJYURM2FiA https://www.typescriptlang.org/play?#code/MYewdgzgLgBKlQIICd...