Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

256
Vistas
How to fix this Asana error "Property 'getTasks' does not exist on type 'Tasks'. Did you mean 'getTask'?" when I call Asana API in React/Next.js?

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.

import asana from "asana";

const GetAsanaData = () => {
  const personalAccessToken = `Bearer 1/1200...`;
  const workspace = "1200...";
  const assignee = "12007...";
  const opt_fields = ["name", "completed", "completed_at"];

  const client = asana.Client.create().useAccessToken(personalAccessToken);
  const result = client.tasks
    .getTasks({
      workspace: workspace,
      assignee: assignee,
      opt_fields: opt_fields,
    })
    .then((response) => response);
  return result;
};

export default GetAsanaData;

First error says;

Could not find a declaration file for module 'asana'. 'C:/Users/81906/Documents/polygon-hr/node_modules/asana/index.js' implicitly has an 'any' type. Try npm i --save-dev @types/asana if it exists or add a new declaration (.d.ts) file containing declare module 'asana';ts(7016)

Then I followed this error and then second error happens and says;

Property 'getTasks' does not exist on type 'Tasks'. Did you mean 'getTask'?ts(2551) index.d.ts(2060, 13): 'getTask' is declared here.

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?


After that, I modified as follows;

// before
import asana from "asana";
↓
// after
const asana = require("asana");

Then this error in title disappeared but another error happened as below.

Failed to compile
./node_modules/readline/readline.js:1:0
Module not found: Can't resolve 'fs'

Import trace for requested module:
./node_modules\asana\lib\auth\native_flow.js
./node_modules\asana\lib\auth\index.js
./node_modules\asana\index.js
./services\asanaService.tsx
./components\RadarChart.tsx
./pages\index.tsx

https://nextjs.org/docs/messages/module-not-found

Converting import to require itself was correct?? If so, should I struggle with this new error "Module not found: Can't resolve 'fs'"?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda