Error - The type you provided for 'FeedMetadata' is not a valid JSON value
Why this error occurred
You have provided a custom FeedMetadata type for your application, but the
type you provided isn’t a (completely) valid JSON value. Values like Date,
Map, Set, functions, classes, or unknown aren’t valid JSON.
In the example above, the problem is in the createdAt field, because a Date
isn’t a valid JSON value.
How to fix it
You’ll need to figure out what part of your provided FeedMetadata type
definition isn’t valid JSON. Sometimes this is immediately obvious, like in the
example above.
Sometimes the issue may be a bit less obvious:
By using Json, you can still work with unknown or unspecified values, but
still ensure they will be valid JSON.
If you cannot find the root cause
Sometimes types can be complex and the root cause is still unclear. In those cases, there is a small trick you can use. Try to assign your type to the required base type, with this line:
Now TypeScript will explain why it thinks your type isn’t valid JSON: