Skip to content

Commit

Permalink
refactor: Update to use TypeScript 2.0 😄 (breaking)
Browse files Browse the repository at this point in the history
It's finally here! 🎆
This refactor updates the way we perform module resolution to make use
of @types/<lib>, removing the dependency on typings, improves the way
the library is bundled while still providing type hints (smaller
downloads and faster npm installs) and makes creating validation plugins
far easier (with the addition of the this:<type> operator in TypeScript
2.0). We've also gone through the codebase and updated it to make use of
strict null checking, which should help prevent a couple of small edge
cases going forward; things that may have been missed during testing. To
compliment that, we've also added support for type checking of your
condition and update arguments, making those more intuitive to use and
more robust against typos.

All this goodness comes at the cost of possible breakage in the way you
use the API, specifically if you add support for strict null checking to
your project, which will enforce some more stringent rules regarding
when things can be used. If you're checking return values for `null` you
will also find that a number of them have been replaced with
`undefined`, hopefully this doesn't affect too many of you (because of
how easy it is to write `if (x) { ... }` instead, but be aware of the
change if you routinely write `if (x === null) { ... }` in your
handlers.
  • Loading branch information
notheotherben committed Jul 29, 2016
1 parent cd4f4fe commit ba773d0
Show file tree
Hide file tree
Showing 124 changed files with 399 additions and 31,032 deletions.
17 changes: 8 additions & 9 deletions .bithoundrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@
},
"dependencies": {
"mute": [
"tsdoc",
"gulp-tsdoc",
"istanbul",
"semver",
"gulp",
"coveralls",
"chai",
"chai-as-promised",
"chalk",
"codeclimate-test-reporter",
"del",
"gulp-bump",
"gulp-istanbul"
"concurrently",
"istanbul",
"mocha"
"tslint",
"typedoc"
]
}
}
14 changes: 2 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
Properties/
bin/
obj/
*.suo
*.user
*.sublime*
node_modules/
.vs
*.dat
.idea
*.tmp
dist
node_modules
coverage/
.tscache
doc
30 changes: 8 additions & 22 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
.idea
.vs
.vscode
benchmarks
build
coverage
doc
example
obj
test
typings
.bithoundrc
.gitattributes
.gitignore
.gitmodules
.jshintrc
.travis.yml
gulpfile.js
Iridium.njsproj
Iridium.sln
Iridium.sublime-*
tslint.json
*
!dist/**
!package.json
!LICENSE
!CHANGELOG.md
!CONTRIBUTING.md
!README.md
!tsconfig.json
187 changes: 0 additions & 187 deletions Iridium.njsproj

This file was deleted.

22 changes: 0 additions & 22 deletions Iridium.sln

This file was deleted.

14 changes: 7 additions & 7 deletions benchmarks/mongodb.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Iridium = require("../iridium");
import Bluebird = require("bluebird");
import MongoDB = require("mongodb");
import _ = require("lodash");
import crypto = require("crypto");
import * as Iridium from "../iridium";
import * as Bluebird from "bluebird";
import * as MongoDB from "mongodb";
import * as _ from "lodash";
import * as crypto from "crypto";

var intensity = 1000;
var samples = 3;
Expand Down Expand Up @@ -38,7 +38,7 @@ class IridiumDB extends Iridium.Core {
console.log("Running benchmark with intensity of %d, %d samples", intensity, samples);

var results: { [name: string]: number } = {};
function benchmark(name: string, prepare: (objects: UserDocument[]) => Bluebird<any>, run: (objects: UserDocument[]) => Bluebird<any>, compareTo?: string) {
function benchmark(name: string, prepare: (objects: UserDocument[]) => Bluebird<any>|null, run: (objects: UserDocument[]) => Bluebird<any>, compareTo?: string) {
return Bluebird.resolve(new Array(samples)).map(() => {
var objects: UserDocument[] = new Array(intensity);
for (var i = 0; i < objects.length; i++)
Expand Down Expand Up @@ -80,7 +80,7 @@ iDB.connect()
return new Bluebird((resolve, reject) => {
iDB.connection.collection("mongodb").deleteMany({},(err) => {
if (err) return reject(err);
return resolve(null);
return resolve({});
});
});
},(objects) => {
Expand Down
15 changes: 0 additions & 15 deletions build/bundle.js

This file was deleted.

32 changes: 0 additions & 32 deletions circle.yml

This file was deleted.

5 changes: 0 additions & 5 deletions dist/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions dist/.npmignore

This file was deleted.

Loading

0 comments on commit ba773d0

Please sign in to comment.