Type ‘number’ is not assignable to type ‘Element’

I am creating custom hook useArray in react with typescript which perform methods of array like push,update,remove etc. In js it is working fine but in ts there are some errors. below are the code from files:
useArray.ts

import { useState } from "react";
export default function useArray<T extends Element>(defaultValue: T[]): {
    array: T[],
    set: React.Dispatch<SetStateAction<T[]>>,
    push: (elemet: T) => void,
    remove: (index: T) => void,
    filter: (callback: (n: T) => boolean) => void,
    update: (index: number, newElement: T) => void,
    clear: () => void

} {
    const [array, setArray] = useState(defaultValue);

    function push(element: T) {
        setArray((a) => [...a, element]);
    }

    function filter(callback: (n: T) => boolean) {
        setArray((a) => a.filter(callback));
    }

    function update(index: number, newElement: T) {
        setArray((a) => [
            ...a.slice(0, index),
            newElement,
            ...a.slice(index + 1, a.length),
        ]);
    }

    function remove(index: number) {
        setArray((a) => [...a.slice(0, index), ...a.slice(index + 1, a.length)]);
    }

    function clear() {
        setArray([]);
    }

    return { array, set: setArray, push, filter, update, remove, clear };
}

ArrayComp.tsx :

import ArrayComp from "./components/ArrayComp";

function App() {
  return (
    <div className="App">
      <ArrayComp />
    </div>
  );
}

export default App;

I am getting this error: “Type ‘number’ is not assignable to type ‘Element'” at multiple places.I want that array elements can be of any possible type but i don’t want to make its type as any.any suggestions will be appreciated.