When checkJs is set to true in tsconfig.json or jsconfig.json and a .vue file which modifies a watched value is opened, Vetur crashes.


Vetur crashing on files like this is almost identical to https://github.com/vuejs/vetur/issues/191#issuecomment-300405883
There is no output from Vue Language Server as it appears to crash. However, there is output from the Window log:
[renderer3] [error] Channel has been closed: Error: Channel has been closed
at ExtHostOutputChannel.validate (/usr/share/vscode/resources/app/out/vs/workbench/node/extensionHostProcess.js:35883:23)
at ExtHostOutputChannel.appendLine (/usr/share/vscode/resources/app/out/vs/workbench/node/extensionHostProcess.js:35863:18)
at LanguageClient.error (/home/USER/.vscode/extensions/octref.vetur-0.11.7/node_modules/vscode-languageclient/lib/client.js:1592:28)
at LanguageClient.logFailedRequest (/home/USER/.vscode/extensions/octref.vetur-0.11.7/node_modules/vscode-languageclient/lib/client.js:2050:14)
at client.sendRequest.then (/home/USER/.vscode/extensions/octref.vetur-0.11.7/node_modules/vscode-languageclient/lib/client.js:721:24)
at <anonymous>
Extensions
CoenraadS.bracket-pair-colorizer
EditorConfig.EditorConfig
Keno.uikit-3-snippets
Shan.code-settings-sync
Sophisticode.php-formatter
WakaTime.vscode-wakatime
asabil.meson
christian-kohler.npm-intellisense
christian-kohler.path-intellisense
dbaeumer.vscode-eslint
demijollamaxime.bulma
donjayamanne.githistory
ecmel.vscode-html-css
felixfbecker.php-intellisense
formulahendry.auto-close-tag
formulahendry.auto-rename-tag
hnw.vscode-auto-open-markdown-preview
joelday.docthis
mblode.twig-language
minhthai.vscode-todo-parser
ms-python.python
octref.vetur
patrys.vscode-code-outline
rebornix.project-snippets
robertohuertasm.vscode-icons
wayou.vscode-todo-highlight
yycalm.linecount
zhuangtongfa.Material-theme
Open nextgensparx/veturpack in VS Code and then client/components/Test.vue.
It's worth noting that if data2 is changed to data3 in watch, the issue goes away.
Thanks for reporting. I guess this problem comes from TS server.
I will investigate more and report issue to related team.
I saw this error:
.vscode/extensions/octref.vetur-0.11.7/server/node_modules/typescript/lib/typescript.js:72587
throw e;
^
TypeError: Cannot read property 'parameters' of undefined
at inferFromAnnotatedParameters
Boiled down version:
func.ts
interface ComponentOptions<V> {
watch: Record<string, WatchHandler<any>>;
}
type WatchHandler<T> = (val: T) => void;
declare function extend(options: ComponentOptions<{}>): void;
export var vextend = extend
import {vextend} from './func'
// hover on vextend
export var a = vextend({
watch: {
data1(val) {
this.data2 = 1
},
data2(val) { }
}
})
tsconfig.json
{
"compilerOptions": {
"checkJs": true,
"allowJs": true
}
}
Error:
Error processing request. Cannot set property 'typeParameters' of undefined
TypeError: Cannot set property 'typeParameters' of undefined
at assignContextualParameterTypes (/project/node_modules/typescript/lib/tsserver.js:36049:38)
at checkFunctionExpressionOrObjectLiteralMethod (/project/node_modules/typescript/lib/tsserver.js:36336:29)
at checkObjectLiteralMethod (/project/node_modules/typescript/lib/tsserver.js:37103:38)
at checkObjectLiteral (/project/node_modules/typescript/lib/tsserver.js:33798:32)
at checkExpressionWorker (/project/node_modules/typescript/lib/tsserver.js:37192:28)
at checkExpression (/project/node_modules/typescript/lib/tsserver.js:37144:42)
at checkExpressionForMutableLocation (/project/node_modules/typescript/lib/tsserver.js:37088:24)
at checkPropertyAssignment (/project/node_modules/typescript/lib/tsserver.js:37096:20)
at checkObjectLiteral (/project/node_modules/typescript/lib/tsserver.js:33795:32)
at checkExpressionWorker (/project/node_modules/typescript/lib/tsserver.js:37192:28)
at checkExpression (/project/node_modules/typescript/lib/tsserver.js:37144:42)
at checkExpressionWithContextualType (/project/node_modules/typescript/lib/tsserver.js:37034:26)
at checkApplicableSignature (/project/node_modules/typescript/lib/tsserver.js:35155:25)
at chooseOverload (/project/node_modules/typescript/lib/tsserver.js:35460:26)
at resolveCall (/project/node_modules/typescript/lib/tsserver.js:35380:26)
at resolveCallExpression (/project/node_modules/typescript/lib/tsserver.js:35567:20)
at resolveSignature (/project/node_modules/typescript/lib/tsserver.js:35762:28)
at getResolvedSignature (/project/node_modules/typescript/lib/tsserver.js:35782:26)
at Object.getResolvedSignature (/project/node_modules/typescript/lib/tsserver.js:21856:34)
at Object.getSymbolDisplayPartsDocumentationAndSymbolKind (/project/node_modules/typescript/lib/tsserver.js:75554:45)
at Object.getQuickInfoAtPosition (/project/node_modules/typescript/lib/tsserver.js:84632:39)
at IOSession.Session.getQuickInfoWorker (/project/node_modules/typescript/lib/tsserver.js:91480:62)
at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/project/node_modules/typescript/lib/tsserver.js:90597:61)
at /project/node_modules/typescript/lib/tsserver.js:92067:88
at IOSession.Session.executeWithRequestId (/project/node_modules/typescript/lib/tsserver.js:92058:28)
at IOSession.Session.executeCommand (/project/node_modules/typescript/lib/tsserver.js:92067:33)
at IOSession.Session.onMessage (/project/node_modules/typescript/lib/tsserver.js:92087:35)
at Interface.<anonymous> (/project/node_modules/typescript/lib/tsserver.js:93288:27)
at emitOne (events.js:96:13)
at Interface.emit (events.js:191:7)
at Interface._onLine (readline.js:241:10)
at Interface._normalWrite (readline.js:384:12)
at Socket.ondata (readline.js:101:10)
at emitOne (events.js:96:13)
at Socket.emit (events.js:191:7)
at readableAddChunk (_stream_readable.js:178:18)
at Socket.Readable.push (_stream_readable.js:136:10)
at Pipe.onread (net.js:560:20)
This issue has already been tracked in https://github.com/Microsoft/TypeScript/issues/23198.
Let's patiently await TS team's fix. Meanwhile we cannot do much in Vue side, so I will close this issue for now.
@HerringtonDarkholme Can this be fixed now that https://github.com/Microsoft/TypeScript/issues/23198 has been closed? The latest version of Vetur (0.16.2) still crashes on the reproduction repository mentioned above.

This seems to be solved in TS 3.3, which you can get by:
yarn add -D [email protected] in workspace"vetur.useWorkspaceDependencies": trueSee #682 for details.
This issue will be completely gone after #1163.
@octref Thanks! That fixes the issue.