Skip to content
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

The TypeScript version seems to be broken, even the examples don't compile #426

Open
ipeychev opened this issue Sep 10, 2024 · 6 comments
Open
Labels

Comments

@ipeychev
Copy link

Describe the Bug
The types are broken, the TypeScript code doesn't compile. I took an example from node_modules/node-zendesk/dist/types/clients/core/tickets.d.ts. Note the @example:

* Create a new ticket.
* @example
     * const newTicket = await client.tickets.create({ subject: 'New ticket', description: 'Ticket description' });
     */
    create(ticket: CreateOrUpdateTicket): Promise<{
        result: Ticket;
    }>;

I took this code and created an app:

Example Code

import { createClient } from "node-zendesk";

async function test123() {
  const client = createClient({});
  const newTicket = await client.tickets.create({ subject: 'New ticket', description: 'Ticket description' });
}

Expected Behavior
The code to compile successfully.

Actual Behavior
There is a compilation error:

Object literal may only specify known properties, and 'subject' does not exist in type 'CreateOrUpdateTicket'.ts(2353)
(property) subject: string

Screenshot 2024-09-10 at 18 32 08

Environment Information

  • node-zendesk version: 5.0.13
  • Node.js version: v20.9.0
  • Operating System: MacOS
  • Any other relevant software versions?

Additional Context

"dependencies": {
    "node-zendesk": "^5.0.13",
    "typescript": "^5.6.2"
  }

Maybe the problem is in the TypeScript version?

@ipeychev ipeychev added the bug label Sep 10, 2024
@m-rolana
Copy link
Contributor

I have it too

@kustomrtr
Copy link

kustomrtr commented Oct 3, 2024

Try importing this:

import type { CreateOrUpdateTicket } from "node-zendesk/dist/types/clients/core/tickets"

and then adding the newly imported CreateOrUpdateTicket type to the object you're passing to the create function:

await client.tickets.create({ subject: 'New ticket', description: 'Ticket description' } as CreateOrUpdateTicket);

@louis49
Copy link

louis49 commented Oct 4, 2024

Same here

@7c
Copy link

7c commented Oct 11, 2024

same here, types and signatures do not match for some reason

@michal-boruczkowski
Copy link

Me too

@m-rolana
Copy link
Contributor

m-rolana commented Nov 6, 2024

@blakmatrix Made a PR with a fix #434 Would appreciate some attention if you have time 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants