Make DialectDetector correctly detect js language from custom JsFileImpl

Hi,

I have a custom JSFile that extends JsFileImpl.

the problem I have that many annotations appear in editor which relate to EcmaScript 5.1.
e.g. trailing comma in object warnings.

I traced it down to DialectDetector.calculateJSLanguage of stub elements returning JavaScript instead of Typescript.

in file JSStubElementImpl.class called in getLanguage

How can I make it correctly detect the JS language?

IntelliJ IDEA 2025.1.1.1 (Ultimate Edition)
Build #IU-251.25410.129, built on May 9, 2025
Source revision: b815cfdcaa594