Error - The type you provided for 'ThreadMetadata' does not match its requirements

Why this error occurred

You have provided a custom ThreadMetadata type for your application, but the type you provided isn’t a (completely) valid definition.

In the example above, there are two problems. Thread metadata may only contain simple key/value pairs, where the values must always be assignable to string | number | boolean | undefined.

How to fix it

You’ll need to figure out what part of your provided ThreadMetadata type definition isn’t valid. The example above could be fixed as such:

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 metadata: