When creating a simple plugin that proxies LanguageService methods (see https://github.com/Microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin), I see new errors in the log when opening files in VSCode:
Err 3697 [16:56:41.128] Exception on executing command delayed processing of request 9: path.charCodeAt is not a function TypeError: path.charCodeAt is not a function at getEncodedRootLength at isRootedDiskPath at Object.toPath at toPath at Object.getSourceFile at getValidSourceFile at Object.getSyntacticDiagnostics at wrapLanguageServiceMethodInResult at Object.proxy.<computed> [as getSyntacticDiagnostics] at IOSession.Session.syntacticCheck at checkOne at MultistepOperation.executeAction at at IOSession.Session.executeWithRequestId at Object.executeWithRequestId at Timeout._onTimeout at listOnTimeout at processTimers
It repros reliably for some files but does not repro for other files.
After debugging I found that the path variable passed to getEncodedRoothLength is not a string as expected, but rather a string array with one string.
🔎 Search Terms
TypeError: path.charCodeAt is not a function
🕗 Version & Regression Information
- I was unable to test this on prior versions because my project is hard to change TS versions on and I do not have a simple reliable repro.
⏯ Playground Link
🙁 Actual behavior
Type error that breaks diagnostics
🙂 Expected behavior