[infobox-parser] Add typings from dts-gen (#36089)

This commit is contained in:
Jeff Held 2019-06-13 15:55:22 -05:00 committed by Ron Buckton
parent a3ba81343f
commit d35d9ea8bd
4 changed files with 57 additions and 0 deletions

21
types/infobox-parser/index.d.ts vendored Normal file
View File

@ -0,0 +1,21 @@
// Type definitions for infobox-parser 3.3
// Project: https://github.com/dijs/infobox-parser#readme
// Definitions by: Jeff Held <https://github.com/solkaz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface ParseOptions {
simplifyDataValues?: boolean;
}
interface ParseResult {
general: any;
lists: any[];
tables: any[];
}
declare function infobox_parser(
source: string,
options?: ParseOptions
): ParseResult;
export = infobox_parser;

View File

@ -0,0 +1,19 @@
import parseInfo = require("infobox-parser");
interface Hero {
name: string;
hero: boolean;
}
const { name, hero }: Hero = parseInfo(`
{{Infobox Batman
|name = Bruce Wayne
|hero = y
}}`).general;
/* Outputs {
general: {
hero: true,
name: 'Bruce Wayne'
}
}
*/

View File

@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": ["index.d.ts", "infobox-parser-tests.ts"]
}

View File

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