contentlayerdev / contentlayerdev/contentlayer
Computed fields in nested types
未关闭
feature
meta: never-stale
pr-welcome
topic: schema
- 主要语言
- TypeScript
- 星标
- 3.5k
- 派生
- 192
- PR 合并指标
- 30 天内没有已合并 PR
描述
I'd like to be able to define computed fields in nested types:
```ts
export const Item = defineNestedType(() => ({
name: "Item",
fields: {
name: { type: "string", required: true },
},
computedFields: {
slug: {
type: "string",
resolve: ({ name }) => slugify(name),
},
},
}))
```
It seems that computed fields are currently only available in document types though. I think supporting computed fields also in nested types would be a great enhancement of this awesome project.
贡献指南
评估
这个 Issue 还没有评估数据。