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

types #288

Open
goodwin64 opened this issue Jan 12, 2024 · 3 comments
Open

types #288

goodwin64 opened this issue Jan 12, 2024 · 3 comments

Comments

@goodwin64
Copy link

Heyyya! Thanks for creating this client. It works quickly and is easy to set up 🔥

One nuance I'd like to bring up is Typescript support. It's 2024 now and more and more code is written with types in mind. There's an open issue on this matter: #244

but it looks like:
a) there are no news or updates for ~1.5 years
b) PR with types mentioned there seems to be stuck outdated with WiP status (DefinitelyTyped/DefinitelyTyped#60589)

The actual types in the DefinitelyTyped project are relevant for the client v0.18, while the latest version of the client right now is v3.0.

In our project, not to play around with Java and openapi-generator-cli dependencies mentioned here, we decided to declare a mini .d.ts types file:

// file is /src/asana/asanaTypes.d.ts

declare module 'asana' {
  export class ApiClient {
    static instance: ApiClient;
    authentications: {
      token: {
        accessToken: string;
      };
    };
  }

  export class TasksApi {
    createTask(body: CreateTaskBody, opts?: any): Promise<CreateTaskResult>;
  }

  export type CreateTaskBody = {
    data: {
      name: string;
      notes: string;
      projects: string[];
    };
  };

  export type CreateTaskResult = {
    // Define the properties of the result as per Asana API's response
    id: string;
    name: string;
    notes: string;
  };
}

I wanted to clarify is there a plan in the roadmap to add a typescript support for v3.0 to either "definitely typed" or directly to this repo?

@tristan-nsg
Copy link

https://www.npmjs.com/package/@types/asana

@samholmes
Copy link

@tristan-nsg Did you even read the post before commenting?

I'm interested in using this library too, and type information is really expected for any serious project (especially one which a lot of API).

I wonder how far we can get with a PR to add the .d.ts file to this project (no DefinitelyTyped needed).

@unickq
Copy link

unickq commented Nov 4, 2024

November, 11 months passed, and no updates 🐳

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

No branches or pull requests

4 participants