-
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 'ApiClient' does not exist on type 'typeof asana'. Did you mean 'Client'?ts(2551) #296
Comments
Hi @Strooss which version of the node-asana are you using? In our v1.X.X (EX:v1.0.5) you would use const asana = require('asana');
const client = asana.Client.create().useAccessToken("<YOUR_ASANA_PERSONAL_ACCESS_TOKEN>");
client.users.getUser("me").then((result) => {
console.log(result);
}); const Asana = require('asana');
let client = Asana.ApiClient.instance;
let token = client.authentications['token'];
token.accessToken = "<YOUR_ASANA_PERSONAL_ACCESS_TOKEN>";
let usersApiInstance = new Asana.UsersApi();
let user_gid = "me"; // String | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.
let opts = {};
usersApiInstance.getUser(user_gid, opts).then((result) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
}, (error) => {
console.error(error.response.body);
}); |
@Strooss the
then restart your editor, and the type issues should disappear. Sadly you'll have no types 😞 |
Yes im using the last version (node-dsk-v3). and yes the package don't have types right? |
Hi @Strooss, @oev-chrisbennett is correct. The @types/asana package only works with node-asana v1 client library version. node-asana v3 client library version is not supported. For context, we did not write or maintain the @types/asana package. It looks like an external dev worked on this and had to manually maintain it by updating it when our API changes. Taking a look at the commit history for @types/asana it looks like the last major update to the types was 2 years ago. |
I see, that you have a lot of jsdocs in the source, which should enable typescript to create types while using this lib. |
Types don't really match the code
The text was updated successfully, but these errors were encountered: