It seems that the error is coming from the TypeScript extension, which is also handling the JavaScript IntelliSense. Due to some UX ignorance, VSCode prefixes the error with [ts] instead of [js].
To disable these validations, set
"javascript.validate.enable": false
See this issue for more details.