nitropage
Version:
A free and open source, extensible visual page builder based on SolidStart.
11 lines (9 loc) • 344 B
text/typescript
export const spliceValue = <T>(value: T, items?: T[]) => {
if (!items) return;
const idx = items.indexOf(value);
if (idx === -1) return;
items.splice(idx, 1);
};
// https://stackoverflow.com/a/64294629
// This returns the array value with enforced item types without readonly
export const Tuple = <T extends [any, ...any]>(v: T) => v;