Skip to content

types#288

Description

@MaxDonchenko

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?

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions