frictionlessdata / datapackage-js

A JavaScript library for working with Data Package.
http://frictionlessdata.io/
MIT License
42 stars 15 forks source link

Typescript definition file #115

Closed lpezet closed 3 years ago

lpezet commented 3 years ago

I'm tying to use Datapackage in a Typescript environment. I couldn't find any definition file for Datapackage. Did I miss it?

Since I couldn't find them, I decided to go ahead and create entries in DefinitelyTyped (https://github.com/DefinitelyTyped/DefinitelyTyped) project. You can see my "Datapackage"-related changes (Datapackage and Tableschema) here: https://github.com/DefinitelyTyped/DefinitelyTyped/compare/master...lpezet:master

I'm no Typescript expert, and I only use some features of Datapackage. I'm sure I misrepresented things in those definition files (for example, are all options really optional in load and iter? does the source parameter as a function in Table.load() really only returns Stream? etc.)

I wanted to run it by you before submitting a Pull Request to the DefinitelyTyped team (process I'm very unfamiliar with). I'm fine handed it over to you guys from here, or going all the way and submitting the Pull Request with DefinitelyTyped (but I'd really appreciate if someone from Frictionlessdata could just check what I coded so far).

Just trying to help :)

roll commented 3 years ago

Hi @lpezet,

Thanks for your contribution. We actually have one for tableschema also received from a contributor- https://github.com/frictionlessdata/tableschema-js/blob/master/index.d.ts.

WDYT if it will be better to add index.d.ts to the datapackage-js instead of having it in @types?

lpezet commented 3 years ago

Hi @roll !

It makes sense to be part of datapackage-js. I was going the @types way to avoid adding to your plate/responsibilities and messing up with TS/Lint and such in your existing (package.json) setup. I'll check tableschema-js' index.d.ts and tweak mine as needed. I might then fork datapackage-js and follow similar approach for adding index.d.ts.

Thanks.

roll commented 3 years ago

Awesome, thank you!

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.