mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Add types for tableify (#30573)
This commit is contained in:
committed by
Pranav Senthilnathan
parent
9b4c987265
commit
f1e4894762
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for tableify 1.1
|
||||
// Project: https://github.com/wankdanker/node-tableify
|
||||
// Definitions by: Emily Marigold Klassen <https://github.com/forivall>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export = tableify;
|
||||
|
||||
declare function tableify<T extends Record<string, any>>(
|
||||
obj: T | ReadonlyArray<T>,
|
||||
columns?: ReadonlyArray<keyof T> | false,
|
||||
parents?: any[]
|
||||
): string;
|
||||
declare function tableify(obj: any): string;
|
||||
declare namespace tableify {
|
||||
interface Config {
|
||||
classes?: boolean;
|
||||
classPrefix?: string;
|
||||
}
|
||||
function defaults(config: Config): {
|
||||
<T extends Record<string, any>>(
|
||||
obj: T | ReadonlyArray<T>,
|
||||
columns?: ReadonlyArray<keyof T> | false,
|
||||
parents?: any[]
|
||||
): string;
|
||||
(obj: any): string;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import tableify = require('tableify');
|
||||
|
||||
const html = tableify({
|
||||
someArrayOfObjects: [
|
||||
{a: 1, b: 2, c: 3}
|
||||
, {a: 2, b: 3, c: 4}
|
||||
, {a: 3, b: 4, c: 5}
|
||||
]
|
||||
, someObject: {
|
||||
key1: 'value1'
|
||||
, someArray: [
|
||||
'value2'
|
||||
, 'value3'
|
||||
, 'value4'
|
||||
, 'value5'
|
||||
]
|
||||
, someArrayOfObjects: [
|
||||
{key2: 123}
|
||||
, {key2: 234}
|
||||
, {key2: 345}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
html;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"tableify-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user