Closed Raynos closed 10 years ago
Oh, no - but then we end up with cross-module interface dependencies, which themselves can (should) be versioned.
In-scope, I think it makes the most sense, for example, to alias eg "mongodb/Db" to something like type MongoDb
. This makes it more obvious that you're depending on the interface, rather than the implementation. In theory, if your module requires something that looks like the mongodb
Db interface, I should be able to create some other object which has the same interface and it would be consumable by your module.
It would be convenient to have a way to cite interfaces from a concrete module. In minq, I do this by linking to the description of the interface in the other module's documentation. In my case, I think it achieves an adequate trade off of clarity vs explicitness, although it's not readily machine parseable.
For tooling, you would want a local definition of the interface in any case. If more people adopt jsig, it would be possible to have a standard way to publish and share type definitions, perhaps like https://github.com/borisyankov/DefinitelyTyped
This is solved with import syntax.
I have some conflict in my
continuable-mongo
where I'm trying to define types forCollection
andClient
but the underlyingmongodb
driver already has types forDb
/MongoClient
/Collection
So I want a way to solve this ambigious-ness by namespacing the types and prefixing them with the npm package.
I'm not sure whether the
/
delimiter is best.Maybe also use quotes