Menu

Treat agent-suggested any / as casts on UI props as a merge blocker
📰

Treat agent-suggested any / as casts on UI props as a merge blocker

DEV Community: frontend·Sherotree·3 days ago
#ztamojEP
#devtofrontend#devto#dev#type#component
Reading 0:00
15s threshold

The component compiles. That’s because the agent wrote props as any , or value as string , or sprinkled // @ts-expect-error on a <Select> that now takes a number . The runtime still blows up when the form submits "" .

I’ve started treating new any / as on UI props as a merge blocker, not a typing nit. The cast is often hiding the actual bug the PR was supposed to fix.

Where the casts show up

Typical patterns in agent diffs:

...(props as any) to spread into a design-system component

onChange={(e: any) => ...} because the event type didn’t match

items as Foo[] after a filter that TypeScript correctly widened

<Button {...(rest as ButtonProps)}> when rest still contains a href

as unknown as Props — two casts, still one lie

Agents do this when the types are right and the call site is wrong, or when a union wasn’t narrowed. A cast makes the screenshot possible.…

Continue reading — create a free account

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