export const shallowClone = < T > ( x ) : T => { if ( Array . isArray ( x ) ) { return [ ... ( x as unknown [ ] ) ] as unknown as T ; } if ( typeof x === 'object' ) { return { ... x } ; } return x ; } ;