'Interface declaring a function with function parameter [duplicate]

An interface declares a function that accepts a function as a parameter. Why the compiler does not throw an error if an implementation doesn't have such parameter? Is there a possibility to force this behaviour?

interface Iterable2<T> {
    iterate(callback: (element: T) => void): void;
}

class NumberIterable2 implements Iterable2<number> {
    iterate(): void {
        // no error?
    }
}

Tested with:

deno 1.19.0 (release, x86_64-pc-windows-msvc)
v8 9.9.115.7
typescript 4.5.2


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source