contentlayerdev / contentlayerdev/contentlayer

Exploring alternative approaches to lists

オープン
#88 コメント 0 件 リアクション 4 件 担当者 0 名 GitHub で見る
feature pkg/source-files
主要言語
TypeScript
スター
3.5k
フォーク
192
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。