Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Michalfrantisek's avatar

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's avatar

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