https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener addEventListener() can be called with either an object or (IME much more commonly) a function as its second argument. In the latter case, the following error or one similar to it is displayed: Problem in Semantic analysis: Possible type mismatch between the argument type (EventListener) and the value passed as argument (function void ())
This only seems to happen when the useCapture (third) argument is provided.
Can you reduce that to a simple test case?
The 13-line example on the linked page (https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#JavaScript_Content) encounters it. Cut down further: function someFunction() {} var el = document.getElementById('elephant'); el.addEventListener("click", someFunction, false);
Whoops, missed a semicolon on the first line. In fact, KDevelop doesn't like having an object as the second argument either (contrary to what my original report implies). var listener = { handleEvent: function(event) {} }; var el = document.getElementById('elephant'); el.addEventListener("click", listener, false); is also flagged as an error. I think the parser is being too picky about what can be an EventListener, given JS's duck typing and lack of inheritance (before ES6).
Happens here (Kdevelop 5.1.1 AppImage) too. I can also confirm that removing the third argument of addEventListener the error is gone.
Could you check if this is still valid in newer KDevelop? There's no error indicated with KDevelop 5.2 here.
Not reproducible for me with 5.2.