Spread types may only be created from object types.ts(2698) code example
Example 1: spread types may only be created from
function foo<T extends object>(t: T): T {
return { ...(t as object) } as T;
}
Example 2: spread types may only be created from
function foo<T extends object>(t: T): T {
return {
...t // Error: [ts] Spread types may only be created from object types.
}
}
Example 3: spread types may only be created from object types firebase
... doc.payload.doc.data() as {}