Typescript
voici.js in combination with Typescript.
Type Information
When using Typescript you can provide the type of the dataset rows using the diamond <> operator.
import { Table } from 'voici.js'
interface IPerson {
firstname: string;
lastname: string;
age: number;
}
const data = [
{ firstname: 'Homer', lastname: 'Simpson', age: 39 },
{ firstname: 'Marge', lastname: 'Simpson', age: 36 },
{ firstname: 'Bart', lastname: 'Simpson', age: 10 },
{ firstname: 'Lisa', lastname: 'Simpson', age: 8 },
{ firstname: 'Maggie', lastname: 'Simpson', age: 1 }
];
const table = new Table<IPerson>(data);Here, table.dataset is of type Person[].
Config
When declaring a config variable you might have to set the according type.
Last updated
Was this helpful?