payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
24.76k stars 1.57k forks source link

serialize.tsx in website template after upgrade #7536

Open alsherif-khalaf opened 2 months ago

alsherif-khalaf commented 2 months ago

Link to reproduction

No response

Payload Version

v3.0.0-beta.74

Node Version

v20.16.0

Next.js Version

15.0.0-canary.58

Describe the Bug

https://github.com/payloadcms/payload/blob/beta/templates/website/src/app/components/RichText/serialize.tsx

After upgrade to beta.74


./src/app/components/RichText/serialize.tsx:24:7
Type error: Type '{ richText?: { [k: string]: unknown; root: { type: string; children: { [k: string]: unknown; type: string; version: number; }[]; direction: "ltr" | "rtl"; format: "" | "left" | "start" | "center" | "right" | "end" | "justify"; indent: number; version: number; }; }; links?: { ...; }[]; id?: string; blockName?: string...' does not satisfy the constraint 'JsonObject'.
  Type 'BannerBlock' is not assignable to type 'JsonObject'.
    Index signature for type 'string' is missing in type 'BannerBlock'.

  22 |   | DefaultNodeTypes
  23 |   | SerializedBlockNode<
> 24 |       | Extract<Page['layout'][0], { blockType: 'cta' }>
     |       ^
  25 |       | Extract<Page['layout'][0], { blockType: 'mediaBlock' }>
  26 |       | BannerBlockProps
  27 |       | CodeBlockProps
   Linting and checking validity of types  .. ELIFECYCLE  Command failed with exit code 1.

Reproduction Steps

just

npx create-payload-app@beta --use-pnpm -t website

then upgrade

npx create-payload-app@beta --use-pnpm

Adapters and Plugins

No response

paulpopus commented 2 months ago

Assigning to @AlessioGr , he's been busy with a big PR. I will update the website template after that PR is merged and we'll get this type issue solved

JarrodMFlesch commented 2 months ago

@alsherif-khalaf All your package versions are on the latest/same version right?

alsherif-khalaf commented 2 months ago

@alsherif-khalaf All your package versions are on the latest/same version right?

yes

{
  "name": "snefru.dev",
  "version": "1.0.0",
  "description": "snefru.dev",
  "license": "MIT",
  "type": "module",
  "scripts": {
    "build": "cross-env NODE_OPTIONS=--no-deprecation next build",
    "dev": "cross-env NODE_OPTIONS=--no-deprecation next dev -p 3000",
    "dev:prod": "cross-env NODE_OPTIONS=--no-deprecation rm -rf .next && pnpm build && pnpm serve",
    "generate:types": "cross-env NODE_OPTIONS=--no-deprecation payload generate:types",
    "ii": "cross-env NODE_OPTIONS=--no-deprecation pnpm --ignore-workspace install",
    "lint": "cross-env NODE_OPTIONS=--no-deprecation next lint",
    "lint:fix": "cross-env NODE_OPTIONS=--no-deprecation next lint --fix",
    "payload": "cross-env NODE_OPTIONS=--no-deprecation payload",
    "reinstall": "cross-env NODE_OPTIONS=--no-deprecation rm -rf node_modules && rm pnpm-lock.yaml && pnpm --ignore-workspace install",
    "start": "cross-env NODE_OPTIONS=--no-deprecation next start -p 3000"
  },
  "dependencies": {
    "@formatjs/intl-localematcher": "^0.5.4",
    "@payloadcms/db-postgres": "3.0.0-beta.74",
    "@payloadcms/live-preview-react": "3.0.0-beta.74",
    "@payloadcms/next": "3.0.0-beta.74",
    "@payloadcms/plugin-cloud": "3.0.0-beta.74",
    "@payloadcms/plugin-form-builder": "3.0.0-beta.74",
    "@payloadcms/plugin-nested-docs": "3.0.0-beta.74",
    "@payloadcms/plugin-redirects": "3.0.0-beta.74",
    "@payloadcms/plugin-seo": "3.0.0-beta.74",
    "@payloadcms/richtext-lexical": "3.0.0-beta.74",
    "@payloadcms/ui": "3.0.0-beta.74",
    "@radix-ui/react-checkbox": "^1.0.4",
    "@radix-ui/react-label": "^2.0.2",
    "@radix-ui/react-select": "^2.0.0",
    "@radix-ui/react-slot": "^1.0.2",
    "autoprefixer": "^10.4.19",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.1",
    "cross-env": "^7.0.3",
    "embla-carousel-autoplay": "^8.1.7",
    "framer-motion": "^11.3.6",
    "geist": "^1.3.0",
    "graphql": "^16.8.1",
    "js-cookie": "^3.0.5",
    "jsonwebtoken": "9.0.1",
    "lexical": "0.16.1",
    "lucide-react": "^0.378.0",
    "negotiator": "^0.6.3",
    "next": "15.0.0-canary.58",
    "payload": "3.0.0-beta.74",
    "payload-admin-bar": "^1.0.6",
    "postcss": "^8.4.39",
    "prism-react-renderer": "^2.3.1",
    "react": "19.0.0-rc-6230622a1a-20240610",
    "react-dom": "19.0.0-rc-6230622a1a-20240610",
    "react-hook-form": "7.45.4",
    "react-icons": "^5.2.1",
    "sharp": "0.32.6",
    "tailwind-merge": "^2.3.0",
    "tailwindcss": "^3.4.7",
    "tailwindcss-animate": "^1.0.7",
    "typescript": "^5.5.4"
  },
  "devDependencies": {
    "@next/eslint-plugin-next": "^13.1.6",
    "@payloadcms/eslint-config": "^1.1.1",
    "@tailwindcss/typography": "^0.5.13",
    "@types/escape-html": "^1.0.2",
    "@types/negotiator": "^0.6.3",
    "@types/node": "18.11.3",
    "@types/react": "npm:types-react@19.0.0-rc.0",
    "@types/react-dom": "npm:types-react-dom@19.0.0-rc.0"
  },
  "engines": {
    "node": "^18.20.2 || >=20.9.0"
  },
  "overrides": {
    "@types/react": "npm:types-react@19.0.0-rc.0",
    "@types/react-dom": "npm:types-react-dom@19.0.0-rc.0",
    "tailwindcss": "npm:^3"
  }
}
paulpopus commented 2 months ago

Yeah I think this is a known bug, we've just had one other PR interfere with us getting to it but we will, I'd recommend staying on the template's default versions for now if possible