DefinitelyTyped / dt-mergebot

The bot which handles auto-merging your PRs
https://devblogs.microsoft.com/typescript/changes-to-how-we-manage-definitelytyped/
MIT License
112 stars 44 forks source link

TS2769 : Argument of type '"wheel-event"' is not assignable to parameter of type '"will-resize"' #474

Closed raphael10-collab closed 1 year ago

raphael10-collab commented 1 year ago

I opened this issue: https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/66156#discussion-5434066 : TS2769 : [@typescript/electron] Argument of type '"wheel-event"' is not assignable to parameter of type '"will-resize"

But actually the @types are not defined in a separated @types/electron but "embedded" within electron

In main process :

    SearchWindow.on("wheel-event", (event, args) => {
        console.log("SearchWindow.on-wheel-event-args: ", args)
    })

In the renderer process:

    let propertiesToClone = ['deltaX', 'deltaY', 'metaKey', 'ctrlKey', 'defaultPrevented', 'clientX', 'clientY']
    function cloneEvent (e) {
        let obj = {}
        for (let i = 0; i < propertiesToClone.length; i++) {
            obj[propertiesToClone[i]] = e[propertiesToClone[i]]
        }
        return JSON.stringify(obj)
    }

    setTimeout(function () {
        window.addEventListener('wheel', function (e) {
            window.api.electronIpcSend('wheel-event', cloneEvent(e))
        })
        let scrollTimeout = null
        window.addEventListener('scroll', function () {
            clearTimeout(scrollTimeout)
            scrollTimeout = setTimeout(function () {
                window.api.electronIpcSend('scroll-position-change', Math.round(window.scrollY))
            }, 200)
        })
    }, 0)

People in the Electron Discord Forum say it's a typescript issue.

electron: 25.3.1
typescript: 4.5.4

Would you be so kind in helping find the root cause of the problem, in order to solve it?