vault backup: 2026-05-15 16:51:21

This commit is contained in:
Vadym Samoilenko 2026-05-15 16:51:21 +01:00
parent 45df362a22
commit afe18ad470
2 changed files with 15 additions and 2 deletions

View file

@ -1,11 +1,15 @@
---
tags: [payloadcms, tech-patterns]
title: "Payload CMS — TypeScript"
aliases: [payload-typescript, payloadcms-typescript]
tags: [payloadcms, typescript, tech-patterns]
topic: payloadcms
sources:
- raw/typescript__overview.md
- https://payloadcms.com/docs/typescript/overview
- https://payloadcms.com/docs/typescript/generating-types
- https://payloadcms.com/docs/typescript/ts-plugin
created: 2026-05-15
updated: 2026-05-15
---
# PayloadCMS — TypeScript
@ -13,9 +17,18 @@ created: 2026-05-15
## Overview
- Payload is built entirely in TypeScript — native first-class support, no bolt-on.
- Scaffold with `npx create-payload-app@latest` and pick a TS template.
- Scaffold a new project: `npx create-payload-app@latest` → pick a TypeScript template.
- The generated `payload-types.ts` file wires up automatic type inference across the entire Local API.
## Key Takeaways
- Payload is TypeScript-native — all internals, config, hooks, and access control are fully typed.
- Use `npx create-payload-app@latest` to bootstrap; all templates are TypeScript by default.
- Run `payload generate:types` after every schema change to keep `payload-types.ts` in sync.
- Export custom reusable types using `interfaceName` on group/array/block/tab fields.
- The `@payloadcms/typescript-plugin` adds IDE path validation and autocomplete for `PayloadComponent` strings — it does NOT affect `tsc` or builds.
- Exported types cover: Config, Collections, Globals, Fields, Hooks, and FormState.
## Key Steps / Concepts
### Generating Types