Closed
Description
Hello,
it seems like type checking in JS files provided by VS Code cannot handle optional elements in tuples.
Code
/**
* @param {[string, number, number?]} val1
*/
function f(val1){}
f(['hi', 4]) <-- error
Error message:
Argument of type '[string, number]' is not assignable to parameter of type '[string, number, number]'.
Property '2' is missing in type '[string, number]' but required in type '[string, number, number]'.ts(2345)
TypeScript itself is handling it as expected: Playground Link
Search Terms:
tuple optional
VS Code Info:
Version: 1.44.0 (user setup)
Commit: 2aae1f26c72891c399f860409176fe435a154b13
Date: 2020-04-07T23:31:18.860Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18362