contentlayerdev / contentlayerdev/contentlayer

Exploring alternative approaches to lists

Đang mở
#88 0 bình luận 4 reaction 0 người được giao Xem trên GitHub
feature pkg/source-files
Ngôn ngữ chính
TypeScript
Star
3.5k
Fork
192
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

The way lists work have been tripping me up in writing the documentation. I'm documenting how they behave today, but they feel a little too magical. For example, there is different behavior based on the type of the `of` option.

Perhaps any field could be a list. I could do something like this:

```js
{
fields: {
// ...
tags: { type: 'reference', of: Tag, list: true }
}
}
```

If we were to do that, it would also be interesting to consider if any field could then be polymorphic. For example, what if I wanted a list of strings or numbers?

```js
{
fields: {
// ...
someListField: { type: ['string', 'number'], list: true }
}
}
```

This polymorphic field type could be interesting to consider outside this context, too. Perhaps any field (not just a list) could be one of multiple types and still be valid.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.