mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[infobox-parser] Add typings from dts-gen (#36089)
This commit is contained in:
parent
a3ba81343f
commit
d35d9ea8bd
21
types/infobox-parser/index.d.ts
vendored
Normal file
21
types/infobox-parser/index.d.ts
vendored
Normal 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;
|
||||
19
types/infobox-parser/infobox-parser-tests.ts
Normal file
19
types/infobox-parser/infobox-parser-tests.ts
Normal 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'
|
||||
}
|
||||
}
|
||||
*/
|
||||
16
types/infobox-parser/tsconfig.json
Normal file
16
types/infobox-parser/tsconfig.json
Normal 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"]
|
||||
}
|
||||
1
types/infobox-parser/tslint.json
Normal file
1
types/infobox-parser/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user