Version 7.0.0-alpha.11
Pre-releaseThis release adds support for TypeScript 2.0 and takes advantage of some of its new features to make Iridium better than ever. π
TL;DR
- Switched from
typings
to@types/...
. - Smaller
npm
packages with the same developer experience. - Switched to TypeScript 2.0
- Much better custom validator developer experience.
- Fewer edge case bugs thanks to
strictNullChecking
in TypeScript 2.0.
- Breaking changes since
7.0.0-alpha.10
Core.connection
throws an exception if the core is not connected.- All database methods now resolve to
undefined
if the item is not found.
Changes
Specifically, we've moved to using @types/...
through npm
as a replacement for typings
, this should significantly improve the developer workflow and we've updated the Example Project to showcase this.
We've also moved towards bundling only the type definitions, compiled JS and source maps in the NPM package, this should help reduce the installed size of Iridium while still being extremely easy to use. For bonus points, take a look at source-map-support
to start getting accurate stack traces against the TypeScript files in your project.
For those of you who use custom validators, TypeScript 2.0's support for typing this
in functions should make your declarations easier than ever, finally providing accurate type information in your custom validators. This should help make them far easier to use going forward.
Last, but certainly not least, we've gone through the codebase and updated it to work with strictNullChecking
enabled, which caught a number of small corner cases which we had missed in testing.
Breaking Changes
There are, unfortunately, a couple of breaking changes in this release. This was primarily the result of switching to strict null checking, requiring us to specify the exact behaviour of certain methods.
- Accessing
Core.connection
before callingCore.connect()
will now result in an exception warning you of the fact. This was previously handled in the model and could result in situations where you received a null connection fromCore.connection
. - All database method callbacks and promises resolve to
undefined
when items are not found (they were previously unconstrained to eitherundefined
ornull
). If you are explicitly checking fornull
you will need to update your code from this:
model.get().then(item => {
if (item === null) {
// do something
}
});
to this:
model.get().then(item => {
if (item === undefined) {
// do something
}
});
or this:
model.get().then(item => {
if (!item) {
// do something
}
});