dd icon indicating copy to clipboard operation
dd copied to clipboard

TypeScript Argument Expectation

Open parker-codes opened this issue 5 years ago • 2 comments

Error

TSError: ⨯ Unable to compile TypeScript:
index.ts:15:1 - error TS2554: Expected 3 arguments, but got 1.

Code

import dd from '@nunomaduro/dd';

class Person {
  firstName: string;
  lastName: string;

  constructor(firstName: string, lastName: string) {
    this.firstName = firstName;
    this.lastName = lastName;
  }
}

const person = new Person('Parker', 'McMullin');

dd(person);

Here is a screenshot of what I see the parameters are:

Repl_it_-_Test_DD

Potential Solution

From what I read in the actual source code, it appears that the typings just need to be updated because dd is only expecting a readonly any[] args list.

parker-codes avatar Dec 20 '19 17:12 parker-codes

Weird. The typings that ship with the package are correct: https://cdn.jsdelivr.net/npm/@nunomaduro/[email protected]/dist/dd.d.ts.

What version of typescript are you using?

nunomaduro avatar Dec 20 '19 18:12 nunomaduro

v3.3.3, so not too outdated. Here's a REPL.

parker-codes avatar Dec 20 '19 18:12 parker-codes