Add definitions for ink-table

This commit is contained in:
lukostry 2019-02-18 14:23:20 +01:00
parent d77c47c753
commit 233f4e2101
4 changed files with 93 additions and 0 deletions

23
types/ink-table/index.d.ts vendored Normal file
View File

@ -0,0 +1,23 @@
// Type definitions for ink-table 1.0
// Project: https://github.com/maticzav/ink-table#readme
// Definitions by: Łukasz Ostrowski <https://github.com/lukostry>
// Definitions: https://github.com/DefinitelyTyped/
// TypeScript Version: 2.8
import { InkComponent, InkNode, StatelessComponent } from 'ink';
export interface TableProps {
cell?: InkComponent;
data?: ReadonlyArray<object>;
header?: InkComponent;
padding?: number;
skeleton?: InkComponent;
}
export const Cell: StatelessComponent<{ children: InkNode }>;
export const Header: StatelessComponent<{ children: InkNode }>;
export const Skeleton: StatelessComponent<{ children: InkNode }>;
declare const Table: StatelessComponent<TableProps>;
export default Table;

View File

@ -0,0 +1,45 @@
/** @jsx h */
import { h } from 'ink';
import Table from 'ink-table';
const data = [
{
name: 'Sosa Saunders',
gender: 'male',
age: 17,
email: 'sosa.saunders@mail.com',
phone: '+1 (809) 435-2786'
},
{
name: 'Angelina Kirk',
gender: 'female',
age: 3,
email: 'angelina@kirk.io',
phone: '+1 (870) 567-3516'
},
{
name: 'Bradford Rosales',
gender: 'male',
age: 20,
email: 'bradfordrosales@fast.com',
phone: '+1 (918) 573-3240'
},
{
name: 'Gwen Schroeder',
gender: 'female',
age: 17,
email: 'gwen@corp.xyz',
phone: '+1 (987) 417-2062'
},
{
name: 'Ellison Mann',
gender: 'male',
age: 5,
email: 'ellisonmann@katakana.com',
phone: '+1 (889) 411-2186'
}
];
const Basic = () => (
<Table data= { data } />
);

View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"jsx": "react",
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"ink-table-tests.tsx"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }