FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Enable specifying list type in computed fields · Issue #277 · contentlayerdev/contentlayer · GitHub

Enable specifying list type in computed fields #277

Description

As far as I can tell, it isn't possible to specify the of type of lists in computed fields the way that you can in non-computed fields. Thus, this is possible:

fields: {
  tags: {
    type: "list",
    of: { type: "string" },
    default: []
  }  
}

But this is not:

computedFields: {
  segments: {
    type: "list",
    of: { type: "string" },
    resolve: (doc) => { ... }
  }
}

Instead, you can only specify an untyped list, and in the generated output you end up with this:

segments: list

But this raw list type isn't defined!

There may be reasons to explicitly disallow typed lists in computed fields, and if so I'd be curious why! Otherwise, this feels like an oversight to me.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL