JSFiddle - React, Tailwind, and code Playground
by Terrance Smith
TypeScript
class Value {
constructor(public fieldName: string, public separator ? : string) {}
}
class ColumnDef {
constructor(
public columnHeader: string,
public values: Value[],
public href ? : boolean,
public sortable ? : boolean) {
this.href = (!href) ? false: href;
this.sortable = (sortable) ? true: false;
}
constructor(
public columnHeader: string,
public columnName: string,
public href ? : boolean,
public sortable ? : boolean) {
this.href = (!href) ? false: href;
this.sortable = (sortable) ? true: false;
this.values = [
new Value(columnName)
];
}
}
let myDef = new ColumnDef("My Awesome Credit Cards", "creditCard", false, false);
let myOtherDef = new ColumnDef("My Address", "address");
console.log(myDef);
console.log(myOtherDef);