-
Notifications
You must be signed in to change notification settings - Fork 73
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
"Property 'getTasks' does not exist on type 'Tasks'. Did you mean 'getTask'?" but WHY?? #248
Comments
It is probably a typo or outdated content in the doc. The same thing happens to webhook-related content. For anyone who is struggling with the doc, I think at the moment you might need to find the way out by viewing the code inside the module rather than keep reading docs. |
I would like to chime in too since I have been deep in this... ASANA PLEASE FIX! Or how can I help???There is a huge gap between what the docs show and what the module types hint in my editor. I created this hacky stub for myself to get rid of errors, but I feel like each example I grab needs me to fix it up 😞 This works for me for now... import type asana from "asana";
declare module "asana" {
namespace resources {
interface Tags {
/**
* This is barely a stub and incomplete
*/
getTagsForWorkspace(workspaceGid: string): Promise<AsanaBaseApiResponse<asana.resources.Tags.Type>>;
}
interface Tasks {
getSubtasksForTask(taskGid: string): Promise<AsanaBaseApiResponse<asana.resources.Tasks.Type[]>>;
/**
* This is barely a stub and incomplete
*/
getTasksForProject(project: string, params?: Params): Promise<AsanaBaseApiResponse<asana.resources.Tasks.Type[]>>;
}
interface Stories {
/**
* @link https://developers.asana.com/reference/createstoryfortask
*/
createStoryForTask(
taskGid: string,
data:
| {
html_text: string;
is_pinned?: boolean;
sticker_name?: string | null;
}
| {
text: string;
is_pinned?: boolean;
sticker_name?: string | null;
}
): Promise<AsanaBaseApiResponse<resources.Stories.Type>>;
}
interface Webhooks {
createWebhook(def: {
resource: string;
target: string;
filters?: asana.resources.Webhooks.Filter[];
}): Promise<asana.resources.Webhooks.Type>;
}
}
}
export interface AsanaBaseApiResponse {
status: number;
value: unknown;
}
export interface AsanaApiError {
message: string;
help: string;
phrase: string;
}
export interface AsanaSuccessResponse<T = unknown> extends AsanaBaseApiResponse {
status: 200;
value: T;
}
export interface AsanaErrorResponse extends AsanaBaseApiResponse {
status: 400 | 401 | 402 | 403 | 404 | 500;
value: {
errors: AsanaApiError[];
};
}
export type AsanaApiResponse<T = unknown> = AsanaSuccessResponse<T> | AsanaErrorResponse;
export {}; |
Code is here, probably not complex. This code is just hitting the API to get the tasks of a certain worker in a certain workspace in Asana.
First error says;
Then I followed this error and then second error happens and says;
Indeed, if I looked at the referenced index.d.ts(2060, 13), there are no getTasks instead of getTask. However, the official documentation (https://developers.asana.com/docs/get-multiple-tasks) says to call it this way... Is it a bug in the library?
The text was updated successfully, but these errors were encountered: