9 lines
176 B
TypeScript
9 lines
176 B
TypeScript
// @strict
|
|
|
|
function narrow(x: readonly number[] | number): readonly number[] {
|
|
if (x instanceof Array) {
|
|
return x;
|
|
} else {
|
|
return [x];
|
|
}
|
|
} |