Skip to content

Version 7.0.0-alpha.11

Pre-release
Pre-release
Compare
Choose a tag to compare
@notheotherben notheotherben released this 01 Aug 16:18
· 156 commits to main since this release

This release adds support for TypeScript 2.0 and takes advantage of some of its new features to make Iridium better than ever. πŸŽ†

TL;DR

  1. Switched from typings to @types/....
  2. Smaller npm packages with the same developer experience.
  3. Switched to TypeScript 2.0
    1. Much better custom validator developer experience.
    2. Fewer edge case bugs thanks to strictNullChecking in TypeScript 2.0.
  4. Breaking changes since 7.0.0-alpha.10
    1. Core.connection throws an exception if the core is not connected.
    2. 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.

  1. Accessing Core.connection before calling Core.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 from Core.connection.
  2. All database method callbacks and promises resolve to undefined when items are not found (they were previously unconstrained to either undefined or null). If you are explicitly checking for null 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
  }
});