RFC: expose types and utils in static context #902
Description
I just found this, I'm curious why it was defined based on an instance of ipfs, rather than something static since it points at the statically defined types.
My specific use case is to do something like
foo instanceof ipfs.types.CID
but it happens in static functions or places where the ipfs instance isn't passed as a variable, i.e. where I don't easily have access to the "ipfs" variable, but have easy access to the result of
IPFS = require('ipfs')
,The current code does
CID=require('cids')
solely to allow this type check, which seems exactly the kind of example this change was intended to avoid.Originally posted by @mitra42 in #406 (comment)
I remember having similar thoughts at least once (had to make fake instance just to access utils).
Perhaps we could at least support it in the static context by exposing data types and util functions on IPFS
(the static constructor) as well.
Thoughts?