# π¦ Highlights
TypeScript type definitions have been rewritten from the ground up
# πͺ Types
It's been a long time in the works, but js-ipfs@0.55.0
finally lands with a brand new set of TypeScript type definitions entirely re-written from the ground up.
We previously shipped 0.51.0
with bundled TypeScript type definitions which enabled users to explore the IPFS Core API through intellisense (opens new window) and use that to ensure they were calling methods that existed, but the argument and return types were frequently marked any
, which, although would not cause TypeScript compilation errors, gave you little in the way of actual type safety.
Part of the problem is that js-ipfs
exposes the return types of many supporting modules which do not ship with TypeScript definitions. This means we either had to PR support for TypeScript definitions into these modules or type their input/output at the js-ipfs
level which is error prone and makes no guarantees about the actual underlying code.
We took a look at our stack and started to add TypeScript types from the lowest level up, which has been an enormous job with some 250 pull requests opened, reviewed, merged and shipped as part of this effort. A massive thanks to everyone involved, see the contributors list further down this post for who helped out!
# π noImplicitAny
Early on we decided to enable noImplicitAny (opens new window) in our tsconfig.json
files. This is a strict setting which causes an error when type information for any variable cannot be found.
It means that everything has to be typed internally which increased the amount of work necessary to deliver this release but our internal code is now vastly safer and it even surfaced a few bugs and unhandled edge cases in the implementation so upgrading is very much recommended.
# π€ Future proofing
In line with our supported versions (opens new window), js-ipfs@0.55.0
has dropped support for Node.js < 14. This is so we can support the latest and greatest features without having to carry legacy baggage forward.
We've also switched to using named exports for our top-level modules instead of default exports as it makes them more pleasant to consume from ES module (opens new window) environments. It also means the type definitions generated from JSDoc annotations (opens new window) are more compact and have to jump through fewer hoops to reflect the code they are generated from.
From perspective of the external API, this only affects ipfs-http-client:
// before
const create = require('ipfs-http-client')
const ipfs = create()
// after
const { create } = require('ipfs-http-client')
const ipfs = create()
Finally, in some places we previously returned instances of the bignumber.js (opens new window) moduleβthis has been necessary in the past because JavaScript lacked an arbitrary precision number type. BigInt (opens new window) has been present in all of our supported environments for some time so we've been removing bignumber.js
in favour of BigInt
in the Core API (opens new window).
# ποΈ Upgrade guide
We've taken this opportunity to align the implementation with the published Core API Docs (opens new window). In some cases the accepted input types were broader than what was documented for backward compatibility, but that compatibility comes at the cost of code complexity and added maintenance, so those old code paths have been removed.
If you have coded against the Core API docs you should have very few surprises in store.
The API changes are as follows:
ipfs.bitswap.stat()
- returnedpeers
is astring[]
(wasCID[]
)ipfs.bitstwap.stat()
- returnedblocksReceived
is aBigInt
(wasbignumber.js
)ipfs.bitstwap.stat()
- returneddataReceived
is aBigInt
(wasbignumber.js
)ipfs.bitstwap.stat()
- returnedblocksSent
is aBigInt
(wasbignumber.js
)ipfs.files.rm(path, opts)
-path
arg isstring | string[]
(was...string
)ipfs.files.cp(source, dest, opts)
-source
arg isstring | string[]
(was...string
)ipfs.files.mv(source, dest, opts)
-source
arg isstring | string[]
(was...string
)
# β¨New features
- Support identity hash (
0x00
(opens new window)) inipfs.block.get()
+ipfs.dag.get()
(#3616 (opens new window)) (28ad9ad (opens new window))
# π¨ Breaking changes
- The minimum supported Node.js version is 14
- All Core API methods now have types, some method signatures have changed (see Upgrade Guide above)
- Named exports are now used by the http, grpc and ipfs client modules (see Future proofing, above)
# π·οΈ Bug fixes
- mark ipld options as partial (#3669 (opens new window)) (f98af8e (opens new window))
- only accept cid for ipfs.dag.get (#3675 (opens new window)) (bb8f8bc (opens new window)), closes #3637 (opens new window)
- only use public api in http api server (#3660 (opens new window)) (61d0981 (opens new window)), closes #3639 (opens new window)
- reject requests when cors origin list is empty (#3674 (opens new window)) (0b2d98c (opens new window))
- add missing type import (#3664 (opens new window)) (64cc1e1 (opens new window))
- fix types (#3662 (opens new window)) (0fe8892 (opens new window))
- loosen input type for swarm.connect and swarm.disconnect (#3673 (opens new window)) (46618c7 (opens new window)), closes #3638 (opens new window)
- ignore the ts error caused by the recent protobufjs type change (#3656 (opens new window)) (084589c (opens new window))
- update data type for ws message event handler (#3641 (opens new window)) (4a14d20 (opens new window))
- do not republish self key twice (#3634 (opens new window)) (8545a76 (opens new window))
- fix types (#3662 (opens new window)) (0fe8892 (opens new window))
- update ipfs repo (#3671 (opens new window)) (9029ee5 (opens new window))
- update types after feedback from ceramic (#3657 (opens new window)) (0ddbb1b (opens new window)), closes #3640 (opens new window)
# πΊοΈ Whatβs next?
Check out the js-IPFS Project Roadmap (opens new window) which contains headline features organised in the order we hope them to land.
Only large features are called out in the roadmap, expect lots of small bugfix releases between the roadmapped items!
# π Huge thank you to everyone that made this release possible
- @5310 (opens new window) (1 comment)
- @achingbrain (opens new window) (279 commits, 153 PRs, 16 issues, 172 comments)
- @acolytec3 (opens new window) (1 commit, 1 PR, 1 comment)
- @acostalima (opens new window) (1 PR, 4 comments)
- @akinovak (opens new window) (1 issue)
- @alanshaw (opens new window) (12 commits, 4 PRs, 1 issue, 5 comments)
- @amitOodles (opens new window) (1 issue)
- @ampcpmgp (opens new window) (1 comment)
- @andrew (opens new window) (1 commit)
- @andychri123 (opens new window) (1 issue)
- @aphelionz (opens new window) (1 comment)
- @arnWolff (opens new window) (1 comment)
- @aschmahmann (opens new window) (1 issue, 6 comments)
- @AuHau (opens new window) (1 comment)
- @autonome (opens new window) (2 comments)
- @awantoch (opens new window) (1 comment)
- @b-rohit (opens new window) (1 issue)
- @Bholtland (opens new window) (1 issue, 3 comments)
- @BigLep (opens new window) (21 comments)
- @buchhlz2 (opens new window) (1 comment)
- @bws9000 (opens new window) (1 PR)
- @chrisdukakis (opens new window) (3 PRs, 1 comment)
- @christopheSeeka (opens new window) (1 issue, 2 comments)
- @CluEleSsUK (opens new window) (1 issue, 3 comments)
- @codecov-io (opens new window) (1 comment)
- @D4nte (opens new window) (1 commit, 2 PRs, 6 issues, 15 comments)
- @da-kami (opens new window) (2 issues, 3 comments)
- @danielcjacks (opens new window) (1 comment)
- @dapplion (opens new window) (1 issue, 17 comments)
- @deanpress (opens new window) (1 comment)
- @dejano-with-tie (opens new window) (1 issue, 1 comment)
- @dependabot[bot] (opens new window) (17 commits)
- @devhyunjae (opens new window) (1 issue, 1 comment)
- @dlecan (opens new window) (1 comment)
- @dxtr85 (opens new window) (1 issue, 1 comment)
- @ekumahost (opens new window) (1 issue, 3 comments)
- @elmariachi111 (opens new window) (5 comments)
- @EmiM (opens new window) (1 issue)
- @ericspt (opens new window) (1 comment)
- @expede (opens new window) (1 commit, 1 PR)
- @FCO (opens new window) (1 comment)
- @filoozom (opens new window) (1 PR, 1 issue, 19 comments)
- @Funarp (opens new window) (1 issue, 4 comments)
- @gabigarcez (opens new window) (1 comment)
- @gcxfd (opens new window) (1 issue)
- @georgyo (opens new window) (1 commit, 1 PR)
- @Gozala (opens new window) (16 commits, 10 PRs, 6 issues, 49 comments)
- @hacdias (opens new window) (4 commits)
- @hannahhoward (opens new window) (2 commits, 3 PRs, 5 comments)
- @Hesbon5600 (opens new window) (2 comments)
- @hueimin426 (opens new window) (1 comment)
- @hugomrdias (opens new window) (53 commits, 14 PRs, 3 issues, 20 comments)
- @icidasset (opens new window) (4 comments)
- @igibliss00 (opens new window) (1 issue)
- @iNDicat0r (opens new window) (2 issues, 2 comments)
- @jacobheun (opens new window) (13 commits, 1 PR, 29 comments)
- @javaskript (opens new window) (1 commit, 1 PR)
- @jeffkhull (opens new window) (2 issues, 2 comments)
- @jeffscottward (opens new window) (1 issue, 1 comment)
- @JonathanWilbur (opens new window) (1 issue, 3 comments)
- @JoranHonig (opens new window) (1 issue)
- @jordan-public (opens new window) (1 issue)
- @julienmalard (opens new window) (1 comment)
- @jurelik (opens new window) (2 comments)
- @justinmchase (opens new window) (1 issue, 5 comments)
- @khayliang (opens new window) (1 issue)
- @koivunej (opens new window) (2 comments)
- @kuabhish (opens new window) (1 issue, 3 comments)
- @KyleMaas (opens new window) (1 commit, 3 PRs, 4 issues, 14 comments)
- @lacker (opens new window) (1 comment)
- @LehaoLin (opens new window) (2 PRs, 2 comments)
- @lidel (opens new window) (14 commits, 3 PRs, 2 issues, 45 comments)
- @ludwigschubi (opens new window) (2 commits, 2 PRs, 1 issue, 1 comment)
- @mctrivia (opens new window) (1 issue, 1 comment)
- @mehtaphysical (opens new window) (1 commit, 1 PR)
- @miguelmota (opens new window) (1 commit, 1 PR, 1 issue, 1 comment)
- @mikeal (opens new window) (1 commit, 6 comments)
- @MisterY (opens new window) (1 PR, 1 comment)
- @momack2 (opens new window) (2 comments)
- @mrappard (opens new window) (1 issue, 1 comment)
- @nadimkobeissi (opens new window) (2 commits, 2 PRs, 1 issue, 5 comments)
- @nduchak (opens new window) (2 issues, 1 comment)
- @novaknole (opens new window) (1 issue)
- @obo20 (opens new window) (1 comment)
- @ocknamo (opens new window) (1 issue, 2 comments)
- @oed (opens new window) (3 comments)
- @olizilla (opens new window) (3 commits, 3 PRs, 3 comments)
- @pascalverlinden (opens new window) (1 issue, 1 comment)
- @perfectmak (opens new window) (1 comment)
- @peterbraden (opens new window) (1 issue, 2 comments)
- @phillmac (opens new window) (1 comment)
- @PierreJeanjacquot (opens new window) (1 issue, 1 comment)
- @piskel (opens new window) (1 issue)
- @pmuens (opens new window) (1 commit, 1 PR)
- @PradneshShinde (opens new window) (1 issue)
- @raphael10-collab (opens new window) (8 issues, 22 comments)
- @re2005 (opens new window) (1 comment)
- @rikur (opens new window) (1 comment)
- @rob-deutsch (opens new window) (1 issue)
- @robertkiel (opens new window) (1 PR, 6 comments)
- @RomarQ (opens new window) (2 comments)
- @rrthomas (opens new window) (2 issues, 1 comment)
- @rvagg (opens new window) (47 commits, 24 PRs, 5 issues, 70 comments)
- @SahidMiller (opens new window) (1 commit, 2 PRs)
- @sahilpohare (opens new window) (1 issue)
- @satoshi999 (opens new window) (2 issues)
- @shapnam83 (opens new window) (1 issue, 1 comment)
- @SignpostMarv (opens new window) (1 comment)
- @Slender1808 (opens new window) (1 issue, 1 comment)
- @somay (opens new window) (1 issue)
- @SonataOto (opens new window) (1 comment)
- @stale (1 comment)
- @stbrody (opens new window) (3 issues, 6 comments)
- @Stebalien (opens new window) (6 comments)
- @tabcat (opens new window) (2 comments)
- @teohhanhui (opens new window) (1 comment)
- @terichadbourne (opens new window) (1 comment)
- @TheDiscordian (opens new window) (4 comments)
- @ThomasFreedman (opens new window) (1 comment)
- @TJKoury (opens new window) (2 commits, 2 PRs, 4 issues, 24 comments)
- @tymmesyde (opens new window) (1 comment)
- @uluhonolulu (opens new window) (1 issue, 1 comment)
- @ungarson (opens new window) (1 comment)
- @Usman-Qasim (opens new window) (2 comments)
- @valmack (opens new window) (1 issue, 3 comments)
- @vasco-santos (opens new window) (230 commits, 66 PRs, 8 issues, 167 comments)
- @vmx (opens new window) (41 commits, 11 PRs, 3 issues, 31 comments)
- @vogdb (opens new window) (1 commit, 9 comments)
- @wehriam (opens new window) (1 issue, 1 comment)
- @wemeetagain (opens new window) (1 commit, 1 PR, 1 issue, 2 comments)
- @xmaysonnave (opens new window) (2 issues, 4 comments)
- @xzy-96 (opens new window) (1 issue)
- @yuhr (opens new window) (1 issue, 3 comments)
- @yurtsiv (opens new window) (1 commit, 2 PRs, 1 issue, 10 comments)
- @yusefnapora (opens new window) (1 PR, 4 comments)
- @zerdos (opens new window) (1 issue)
- @Zorlin (opens new window) (1 issue, 3 comments)
# ππ½ Want to contribute?
Would you like to contribute to the IPFS project and donβt know how? Well, there are a few places you can get started:
- Check the issues with the
help wanted
label in the js-IPFS repo (opens new window) - Join an IPFS All Hands, introduce yourself and let us know where you would like to contribute: https://github.com/ipfs/team-mgmt/#weekly-ipfs-all-hands (opens new window)
- Join an IPLD All Hands call if you're interested in the data layer of IPFS: https://github.com/ipld/team-mgmt#every-two-weeks-call (opens new window)
- Hack with IPFS and show us what you made! The All Hands calls are also the perfect venue for demos, join in and show us what you built
- Join the discussion at https://discuss.ipfs.tech/ (opens new window) and help users finding their answers.
- Join the π IPFS Core Implementations Weekly Sync π° (opens new window) and be part of the action!
# βοΈ Do you have questions?
The best place to ask your questions about IPFS, how it works, and what you can do with it is at discuss.ipfs.tech (opens new window). We are also available at the #ipfs
channel on Freenode.