Skip to content

Commit

Permalink
revert: Switch back to type-less Transforms as it would otherwise be …
Browse files Browse the repository at this point in the history
…a breaking change
  • Loading branch information
notheotherben committed Dec 15, 2015
1 parent 67872f2 commit 29a630a
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/Decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export function Transform(fromDB: (value: any, property: string, model: Model<an
return function(target: Instance<any, any>, property: string) {
let staticTarget: InstanceImplementation<any, any> = <InstanceImplementation<any, any>>(target.constructor || target);

staticTarget.transforms = _.clone(staticTarget.transforms || <Transforms<any>>{})
staticTarget.transforms = _.clone(staticTarget.transforms || <Transforms>{})
staticTarget.transforms[property] = {
fromDB: fromDB,
toDB: toDB
Expand Down
2 changes: 1 addition & 1 deletion lib/Instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class Instance<TDocument extends { _id?: any }, TInstance> {
/**
* The transformations which should be applied to properties of documents of this type.
*/
static transforms: Transforms<any> = {
static transforms: Transforms = {

};

Expand Down
2 changes: 1 addition & 1 deletion lib/InstanceInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,5 @@ export interface InstanceImplementation<TDocument extends { _id ?: any }, TInsta
* sent to the database. These may include things such as converting ObjectIDs to strings for the application, and
* then back to ObjectIDs once they return to the database.
*/
transforms?: Transforms<TDocument>;
transforms?: Transforms;
}
2 changes: 1 addition & 1 deletion lib/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export class Model<TDocument extends { _id?: any }, TInstance> {
return this._Instance;
}

private _transforms: Transforms<TDocument>;
private _transforms: Transforms;

/**
* Gets the transforms which are applied whenever a document is received from the database, or
Expand Down
2 changes: 1 addition & 1 deletion lib/Transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import MongoDB = require('mongodb');
import {Model} from './Model';
import * as BSON from './BSON';

export interface Transforms<TDocument> {
export interface Transforms {
/**
* A transform which is applied to the entire document.
*/
Expand Down
2 changes: 1 addition & 1 deletion test/Decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function VersionValidator(schema, data) {
@Iridium.Property('version', 'version')
@Iridium.Property('optional2', Boolean, false)
class Test extends Iridium.Instance<TestDocument, Test> implements TestDocument {
static transforms: Iridium.Transforms<TestDocument> = {};
static transforms: Iridium.Transforms = {};
static indexes = [];

@Iridium.ObjectID
Expand Down
2 changes: 1 addition & 1 deletion test/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Test extends Iridium.Instance<TestDocument, Test> implements TestDocument
}

class TestWithCustomID extends Test {
static transforms: Iridium.Transforms<TestDocument> = {
static transforms: Iridium.Transforms = {
_id: {
fromDB: x => x * 10,
toDB: x => x / 10
Expand Down
2 changes: 1 addition & 1 deletion test/Transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Person extends Iridium.Instance<Document, Person> {
avatar: Buffer
};

static transforms: Iridium.Transforms<Document> = {
static transforms: Iridium.Transforms = {
email: {
fromDB: x => x.toUpperCase(),
toDB: x => x.toLowerCase().trim()
Expand Down

0 comments on commit 29a630a

Please sign in to comment.