Last active
June 5, 2016 16:32
-
-
Save rodoabad/8c429e0371d7ae1862fa46c92596938d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const t = require('tcomb'); | |
const Employee = t.struct({ | |
first: t.String, | |
last: t.String | |
}, 'Employee'); | |
const employee = new Employee({ | |
first: 'Rodo', | |
last: 'Abad' | |
}); | |
console.log(employee); // eslint-disable-line no-console | |
const ExtendedEmployee = Employee.extend({ | |
selected: t.Bool | |
}, 'ExtendedEmployee'); | |
const extendedExmployee = new ExtendedEmployee({ | |
first: 'Rodo', | |
last: 'Abad', | |
selected: true | |
}); | |
console.log(extendedExmployee); // eslint-disable-line no-console | |
const originalEmployee = new Employee(extendedExmployee); | |
console.log(originalEmployee); // eslint-disable-line no-console |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment