Skip to content

"payload-types.ts" in website template always outdated #9864

Open
@bormm

Description

@bormm

Describe the Bug

This is not a regular runtime bug, but I noticed in previous versions and now again in 3.5.0 that the "payload-types.ts" is changed without changing anything in the code. I reproduced this now with a fresh payload app.
Previous fields in meta was removed without having changed something myself:
Image

With 3.5.0 its 46 changes, I think all are string to number, happening:
Image

I think that's a process workflow issue: I guess people are making code changes in collections and so one, but then are not rerunning the "payload generate:types" process. As the changes often do not cause a runtime issue by the nature of the "flexible types handling", nobody is noticing that there is a drift.

My recommendation is that the "run payload generate:types" is put into the PR process and either it fails when there is a change needed, or it applies change automatically and if everything runs is merged.

Why we should care: The template should be consistent and correct from the beginning. Otherwise it will happen that developers waste time analysing why the types are changes to much after running "payload generate:types", only to find out it wasn't anything they have done in the code.

Link to the code that reproduces this issue

https://github.com/payloadcms/payload

Reproduction Steps

  1. run "npx create-payload-app payload-sample -t website"
  2. backup "\src\payload-types.ts"
  3. run "npm run payload generate:types"
  4. compare

Which area(s) are affected? (Select all that apply)

Not sure

Environment Info

Binaries:
  Node: 20.14.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  payload: 3.5.0
  next: 15.0.4
  @payloadcms/email-nodemailer: 3.5.0
  @payloadcms/graphql: 3.5.0
  @payloadcms/live-preview: 3.5.0
  @payloadcms/live-preview-react: 3.5.0
  @payloadcms/next/utilities: 3.5.0
  @payloadcms/payload-cloud: 3.5.0
  @payloadcms/plugin-form-builder: 3.5.0
  @payloadcms/plugin-nested-docs: 3.5.0
  @payloadcms/plugin-redirects: 3.5.0
  @payloadcms/plugin-search: 3.5.0
  @payloadcms/plugin-seo: 3.5.0
  @payloadcms/richtext-lexical: 3.5.0
  @payloadcms/translations: 3.5.0
  @payloadcms/ui/shared: 3.5.0
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 130168
  Available CPU cores: 32

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions