You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm currently using computed fields to add defaults for optional fields. This results in duplicate attributes in the generated document type classes. Is there another way of defining defaults, or should I approach this differently? If not you might consider adding a bugfix to support this scenario of using computed fields to define defaults.
exporttypePost={/** File path relative to `contentDirPath` */_id: string_raw: Local.RawDocumentDatatype: 'Post'title: stringpublishedAt: stringexcerpt: string|undefined/** Markdown file body */body: Markdownslug: stringexcerpt: string}
Despite it works you do see excerpt is twice in the Post type. Once as string and once as string | undefined. The generated JSON itself has the field only once as I would expect.
I should probably mention in my project I'm using this from Javascript. That is probably why all still works. In TypeScript this might give some more issues.
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi, I'm currently using computed fields to add defaults for optional fields. This results in duplicate attributes in the generated document type classes. Is there another way of defining defaults, or should I approach this differently? If not you might consider adding a bugfix to support this scenario of using computed fields to define defaults.
This results in the following:
Despite it works you do see
excerpt
is twice in thePost
type. Once asstring
and once asstring | undefined
. The generated JSON itself has the field only once as I would expect.I should probably mention in my project I'm using this from Javascript. That is probably why all still works. In TypeScript this might give some more issues.
The text was updated successfully, but these errors were encountered: