Michalfrantisek wrote a comment+100 XP
4mos ago
Practical TypeScript for the Laravel Developer: Ep 8, TypeScript Utilities
Read only utility:
type ReadOnly<T> = { readonly [K in keyof T]: T[K] }
Michalfrantisek wrote a comment+100 XP
4mos ago
Practical TypeScript for the Laravel Developer: Ep 7, Where Should Everything Go?
Use type until you need something interface provides.
Both are totally valid and often interchangeable. My personal rule: start with type unless an interface-specific feature makes it necessary.
@JoeBot compare Type vs. Interface