Menu

1 / 2

Symfony Attributes Are Stable. TypeScript Decorators Aren't.

DEV Community·Gabriel Anhaia·6 months ago
#YzebftdZ
#typescript#symfony#php#decorators#article
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

Day two on the new TypeScript team. You left Symfony last Friday. You open the new TypeScript repo, scroll to a controller, and expect to see something close to:

#[Route('/users/{id}', methods: ['GET'])] public function show ( int $id ): Response { /* ... */ }

Enter fullscreen mode

Exit fullscreen mode

What you find instead is one of three different things, depending on which framework the team picked:

// NestJS @ Controller ( ' users ' ) class UsersController { @ Get ( ' :id ' ) show (@ Param ( ' id ' ) id : number ) { /* ... */ } }

Enter fullscreen mode

Exit fullscreen mode

// Hono app . get ( ' /users/:id ' , validate ( IdParam ), async ( c ) => { /* ... */ });

Enter fullscreen mode

Exit fullscreen mode

// tRPC export const users = router ({ show : publicProcedure . input ( z .…

Continue reading — create a free account

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