Js-ipfs: Provide typescript type definitions

Created on 27 Sep 2018  路  12Comments  路  Source: ipfs/js-ipfs

This would be extremely helpful. I have worked with both flow and typescript. Flow has some theoretical advantages, but typescript has way better tooling support and mindshare, which is why I reluctantly switched to typescript.

Please provide typescript type definitions just for the API. That would be extremely helpful.

Most helpful comment

We made typescript support a priority for the next months I'll personally be working on this and would love some help and feedback from you all.

My primary objective is to find the best way to provide accurate and up to date type definitions. It's really important to not make types generation a big burden so we can keep it always in sync with the code.

We want a long term solution to provide the best support for the typescript community.

I have a couple of ideas to do this but I'm gonna need your help to make this work.

What is the best way to validate that type definitions are accurate? Is tsc --no-emit enough? Do we need type definitions tests to actually be useful?

All 12 comments

I second this - type definition absence turns IPFS usage into a complete nightmare on TypeScript projects. I've seen a couple of stubs like that around the GitHub:

https://github.com/beenotung/typestub-ipfs

Probably we can take some of them as a base and modify it for ipfs-api?

We could start by merging stub @sweetpalma mentioned and then add/tweak definitions as we discover missing parts or mismatches.

@daviddias would you be willing to accept PR with minimum typings if i prepare it?

@ondratra what would the PR involve? I'm keen to make it easier for typescript users but I do not want to add any extra overhead for contributors who do not use typescript.

Do they need to live in this repo and can we share them with https://github.com/ipfs/js-ipfs?

I was thinking about starting with code @sweetpalma linked and create typings for API only of js-ipfs-http-client. But you have a good point that typings don't need to be in this repository. I will learn about process of creating @types/js-ipfs-http-client package and put all typings there.

I created typestub-ipfs as a standalone repo, instead of under DefinitelyTyped becuaue their approval process is too complicated for me, especially for a new project (as oppo to update existing one).

I am aware of the benefit if it get merged into DefinitelyTyped though.

Hey, would love some typings too! 馃憤

Found this abandoned PR in DefinitelyTyped repo: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/38308

It may be reused.

We made typescript support a priority for the next months I'll personally be working on this and would love some help and feedback from you all.

My primary objective is to find the best way to provide accurate and up to date type definitions. It's really important to not make types generation a big burden so we can keep it always in sync with the code.

We want a long term solution to provide the best support for the typescript community.

I have a couple of ideas to do this but I'm gonna need your help to make this work.

What is the best way to validate that type definitions are accurate? Is tsc --no-emit enough? Do we need type definitions tests to actually be useful?

We made typescript support a priority for the next months I'll personally be working on this and would love some help and feedback from you all.

My primary objective is to find the best way to provide accurate and up to date type definitions. It's really important to not make types generation a big burden so we can keep it always in sync with the code.

We want a long term solution to provide the best support for the typescript community.

I have a couple of ideas to do this but I'm gonna need your help to make this work.

What is the best way to validate that type definitions are accurate? Is tsc --no-emit enough? Do we need type definitions tests to actually be useful?

Any progress or ETA?
I just published a library for IPFS usage in NestJS typescript framework for node.js, so this would be extremely useful

its in progress, will happen soon.

Can we get an ETA? This has been a blocker for our project and it would be nice if we could get some progress right now.

This is a high priority item on @hugomrdias's list for this quarter - please follow https://github.com/ipfs/js-ipfs/issues/2945 for updates.

Closing this one in favor of https://github.com/ipfs/js-ipfs/issues/2945

Thanks you all 馃檹

Was this page helpful?
0 / 5 - 0 ratings