norberteder / trello

Use the Trello API from Node
333 stars 250 forks source link

No Typescript Definitions #59

Open jaredallard opened 6 years ago

jaredallard commented 6 years ago

It'd be awesome if there were some! :sparkles:

sarangjo commented 5 years ago

This would be great for functions as well as the different objects the Trello API offers! If I can find some free time I might take a crack at this.

karlvr commented 5 years ago

I have started work on this and will be continuing over the next few weeks and will then submit a PR. Initial work is here:

https://github.com/karlvr/trello/blob/types/index.d.ts

If anyone has made more progress, please let me know and I'll instead contribute to your effort!

There doesn't appear to be a canonical definition of the Trello API, unfortunately. The API documentation seems to gloss over and just simply omit thing! I guess that will make this something of a moving target.

karlvr commented 5 years ago

I've combined this with #74 and I've written a script to automatically generate the types, resulting in https://github.com/karlvr/trello/blob/types-query/index.d.ts

There's obviously more model types to make, but it's a start and the automatic generation script makes it pretty easy to keep up to date.

sheam commented 5 years ago

@karlvr Do you have an example of how to use your typings?

karlvr commented 5 years ago

@sheam I have included them in the package.json, so if you include the library from my fork you magically get the typings. No need to install them separately.

sheam commented 5 years ago

@karlvr so in package.json

    "trello": "https://github.com/karlvr/trello"
  },

Then in code:

const t = new Trello('key', 'token');

This gives me: "trello_1.Trello is not a constructor".

const t = new trello.Trello('', '');

This gives me: "trello.Trello is not a constructor".

karlvr commented 5 years ago

@sheam how did you import it? It should be:

import Trello from 'trello'

and then you should be able to use it:

const t = new Trello('key', 'token');
vaagnavanesyan commented 4 years ago

Hey, any updates here?

ohadch commented 3 years ago

Hey, anything new? I will be glad to help, just don't want to do any duplicate work

karlvr commented 3 years ago

@vaagnavanesyan @ohadch nothing from me. My changes were sufficient for my efforts. I'm not sure whether anyone else has got them working?