Skip to content

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

Description

@lamuertepeluda

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions