Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ValYouW opened this issue Jun 25, 2020 · 0 comments · Fixed by #39606
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@ValYouW
Copy link

ValYouW commented Jun 25, 2020

  • 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

@mjbvz mjbvz transferred this issue from microsoft/vscode Jun 25, 2020
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Jun 25, 2020
@RyanCavanaugh RyanCavanaugh assigned andrewbranch and unassigned mjbvz Jun 25, 2020
@RyanCavanaugh RyanCavanaugh added this to the Typescript 4.0.1 milestone Jun 25, 2020
@andrewbranch andrewbranch added the Fix Available A PR has been opened for this issue label Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants