如何理解WebStorm的函数接口?

How do you understand WebStorm's function interfaces?

我无法理解某些函​​数及其接口。即:

ReadonlyArray<unknown>.map( 
    callbackfn: (value: unknown, index: number, array: unknown[]) => unknown,
    thisArg?: any): unknown[]

这是当我将鼠标悬停在 .map() 函数上时 WebStorm 显示的内容。我明白.map()是把一个指定的回调函数作为参数,但是=> unknownthisArg?: any代表什么?

同样,当我将鼠标悬停在 forEach() 函数上时,弹出窗口如下所示:

ReadonlyArray<unknown>.forEach(
     callbackfn: (value: unknown, index: number, array: unknown[]) => void,
     thisArg?: any): void

forEach也有一个回调函数作为参数,但是=> void, thisArg?: any): void代表什么?

// the `.map` function is member of the generic type ReadonlyArray<unknown>. Where unknown is the type of the elements of the array
ReadonlyArray<unknown>.map( 
    // first argument is a callback function. The first argument of the callback is value, of type unknown, the second is index of type number, and so on
    callbackfn: (value: unknown, index: number, array: unknown[]) 
       // this parts means that the callback should return a value of type unknown
       => unknown,
    // .map takes a second arguments called thisArg of any type. The ? means that the argument is optional
    thisArg?: any)
    // .map returns an array of type unknown
    : unknown[]

类型未知,因为它取决于应用 .map 的数组中元素的类型。如果是对象数组,则未知类型为 object

类似地,forEach 接受第一个参数,它是一个回调。但是回调 returns 什么都没有,因此你有 => void.