Menu

1 / 2

Eloquent's Magic Is Gone. Drizzle Makes You Name Column Types.

DEV Community·Gabriel Anhaia·6 months ago
#PF05HNek
#typescript#php#schema#drizzle#type
Reading 0:00
15s threshold

Book: PHP to TypeScript

Also by me: The TypeScript Library — the 5-book collection

My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools

Me: xgabriel.com | GitHub

A Laravel developer types $user->posts->first()->title and IDE autocomplete fills in the rest. PHPStan with Larastan groans about mixed until they paste a @property block at the top of the model. The code runs anyway, because Eloquent will look at the table at runtime and figure it out.

A TypeScript developer using Drizzle types user.posts[0].title and the editor knows the type before the file is saved. Not because of a comment block. Because Drizzle compiled the schema declaration into a TS type the moment the file was imported. There is no runtime guess, and no introspection on a connection that is not open yet.

Same business question.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.