wordpress-api-client icon indicating copy to clipboard operation
wordpress-api-client copied to clipboard

The user().total() and media().total() methods are missing in TypeScript

Open lamuertepeluda opened this issue 2 years ago • 1 comments

When using typescript, the method for getting user total, client.user().total(), mentioned in the docs, does not exists/has wrong types.

Same for client.media().total().

I guess there is some errors in the type definitions.

Since you use a lot of factories, perhaps you should consider using some helper such as ReturnType for type defs

To Reproduce

Add this code to some-script.ts

import WpApiClient from "wordpress-api-client";

const client = new WpApiClient('http://mywordpress.site.com')

client.user().total()

When using JavaScript I can see the method. See attached screenshots. Only workaround: add @ts-ignore comment, but this is kinda dirty.

Expected behavior

No type errors when using those methods

Screenshots

TS Error

image

Node Repl

image

Desktop (please complete the following information):

  • OS: macOS Ventura
  • Node: 18.x
  • TypeScript: 5.x

lamuertepeluda avatar Apr 05 '23 08:04 lamuertepeluda

Update: client.media().total() is missing also in JavaScript 😢 , while client.user().total() is only missing types

lamuertepeluda avatar Apr 05 '23 09:04 lamuertepeluda