Skip to content

Instantly share code, notes, and snippets.

@rodoabad
Last active June 5, 2016 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodoabad/8c429e0371d7ae1862fa46c92596938d to your computer and use it in GitHub Desktop.
Save rodoabad/8c429e0371d7ae1862fa46c92596938d to your computer and use it in GitHub Desktop.
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