Skip to content

ts-check error ts(2554) after upgrading to 1.46.1 when calling class member function with optionals #39261

@ValYouW

Description

@ValYouW
  • VSCode Version: 1.46.1 (commit: cd9ea6)
  • OS Version: Windows 10 Pro Version 10.0.19041 Build 19041

After upgrading today to 1.46.1 I started to get many ts(2554) errors (expected X arguments, but got Y) when omitting optional args on a class member function.
For example:

// utils.js
module.exports.foo = function(a) {
  console.log(a);1
}

class SomeClass {
  foo(a) {
    console.log(a);
  }
}

module.exports.SomeClass = SomeClass;
// main.js
var Utils = require('./utils.js');
var sc = new Utils.SomeClass();

sc.foo(); // This will error
Utils.foo(); // no error
innerFoo(); // no error

function innerFoo(a) {
  console.log(a);
}

Attached screenshot with this simple example:
tscheck

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions