SierraSoftworks/Iridium

Some Globals are not exported

Closed this issue · 2 comments

Hi,
is there a reason that some types and interfaces which are listet under Globals in the TypeDoc are not exported and only accessible by directly pointing to their type files like:

import { Conditions } from 'iridium/dist/lib/Conditions';
import { BSONType } from 'iridium/dist/lib/BSON';

Is this the way to go or have I just missed something.

best regards

Hi Manusan42, I'm afraid you're spot on, we haven't exposed a lot of those interface types as part of Iridium's public API. For the most part this is because they're likely to change as MongoDB's client driver does, but also because they're intended to be more of a guideline than a rule - the expectation being that, if you were wrapping Iridium, you'd have stricter constraints on what was permitted in conditions/types.

That being said, the approach you've taken right now is probably the best one for the time being (given that you're only dealing with TypeScript interfaces) however it does leave you open to the potential for code breakage if we move those files around. I try to avoid doing so because I expect that people will use them in the manner you are, but I'll also look at a longer term solution that enables you to access these types in a safe and consistent manner without cluttering things or confusing users too much.

Regards,
Benjamin

Sounds legit, thanks for the insights.
So I stay with this for now and I'm not afraid of refactoring anyways. In fact I like breaking changes as long they make things better ;-)