spread types may only be created from

Solutions on MaxInterview for spread types may only be created from by the best coders in the world

showing results for - "spread types may only be created from"
Soline
23 Apr 2018
1function foo<T extends object>(t: T): T {
2  return { ...(t as object) } as T;
3}
Bowen
12 Feb 2020
1function foo<T extends object>(t: T): T {
2
3  return {
4    ...t    // Error: [ts] Spread types may only be created from object types.
5  }
6}