contentlayerdev / contentlayerdev/contentlayer
Exploring alternative approaches to lists
- Vorherrschende Sprache
- TypeScript
- Sterne
- 3.5k
- Forks
- 192
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Rechercherichtung
Das Issue nennt keine Dateien, Tests oder Einstiegspunkte. Beginne damit, das aktuelle Listenverhalten in der Dokumentation zu prüfen, und kläre anschließend den vorgesehenen Umfang für beliebige Listenfelder und polymorphe Typen; die Arbeit ist erst abgeschlossen, wenn ein abgestimmter Ansatz festgelegt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- content
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 20/100