TS2314

error TS2314: Generic type ‘Omit‘ requires 2 type argument(s).

Broken Code ❌

1
2
3
4
export interface SerializedBatchedCandle extends Omit<BatchedCandle, 'close', 'open'> {
open: string;
close: string;
}

Fixed Code ✔️

When using the Omit utility type, you have to list property overwrites with a pipe (|):

1
2
3
4
export interface SerializedBatchedCandle extends Omit<BatchedCandle, 'close' | 'closeAsk'> {
close: string;
closeAsk: string;
}

TS2314: Generic type ‘ReadonlyArray ‘ requires 1 type argument(s).

Broken Code ❌

1
const array: ReadonlyArray = [1, 2, 3] as const;

Fixed Code ✔️

When using a generic (in this case ReadonlyArray<T>), then you have to pass a type argument to it:

1
const array: ReadonlyArray<number> = [1, 2, 3] as const;