DEV Community

Payload v4: every block gets its own TypeScript interface (hashed on collision) (opens in new tab)

Discussed on DEV

A nice quality-of-life change in Payload v4's type generation. Previously, a block only got its own TypeScript interface if you set interfaceName. In v4 the name is derived automatically from the slug (PascalCased), and when two different blocks would collide on a name, the second one gets a stable suffix from a content hash — so types never silently overwrite each other: // slug 'content-block' -> interface ContentBlock // a colliding block of a different shape -> Hero_3F2A1B0C (deterministi...

Read the original article
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help