mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
🤖 Merge PR #64133 Add type definition for binary-xml package by @ChemiAtlow
This commit is contained in:
17
types/binary-xml/binary-xml-tests.ts
Normal file
17
types/binary-xml/binary-xml-tests.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import * as BinaryXML from 'binary-xml';
|
||||
|
||||
// @ts-expect-error
|
||||
new BinaryXML();
|
||||
|
||||
// @ts-expect-error
|
||||
new BinaryXML('non-buffer');
|
||||
|
||||
new BinaryXML(Buffer.from('buffer'));
|
||||
new BinaryXML(Buffer.from('buffer'), {});
|
||||
new BinaryXML(Buffer.from('buffer'), { debug: false });
|
||||
new BinaryXML(Buffer.from('buffer'), { debug: true });
|
||||
|
||||
// $ExpectType BinaryXmlParser
|
||||
const parser = new BinaryXML(Buffer.from('buffer'));
|
||||
// $ExpectType Document
|
||||
const doc = parser.parse();
|
||||
46
types/binary-xml/index.d.ts
vendored
Normal file
46
types/binary-xml/index.d.ts
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
// Type definitions for binary-xml 0.0
|
||||
// Project: https://github.com/song940/binary-xml#readme
|
||||
// Definitions by: ChemiAtlow <https://github.com/ChemiAtlow>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
interface Options {
|
||||
debug?: boolean;
|
||||
}
|
||||
|
||||
interface Attribute {
|
||||
namespaceURI: string;
|
||||
nodeType: number;
|
||||
nodeName: string;
|
||||
name: string;
|
||||
value: any;
|
||||
typedValue: {
|
||||
value: number; type: string; rawType: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface ChildNode {
|
||||
namespaceURI: string;
|
||||
nodeType: number;
|
||||
nodeName: string;
|
||||
attributes: Attribute[];
|
||||
childNodes: ChildNode[];
|
||||
}
|
||||
|
||||
interface Document {
|
||||
attributes: Attribute[];
|
||||
childNodes: ChildNode[];
|
||||
namespaceURI: string | null;
|
||||
nodeName: string | null;
|
||||
nodeType: number;
|
||||
}
|
||||
|
||||
declare class BinaryXmlParser {
|
||||
constructor(buffer: Buffer, options?: Options);
|
||||
|
||||
parse(): Document;
|
||||
}
|
||||
|
||||
declare const BinaryXML: typeof BinaryXmlParser;
|
||||
export = BinaryXML;
|
||||
23
types/binary-xml/tsconfig.json
Normal file
23
types/binary-xml/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"binary-xml-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/binary-xml/tslint.json
Normal file
1
types/binary-xml/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "@definitelytyped/dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user