mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 04:01:52 +00:00
feat: Add w3c‑xmlserializer (#41389)
This commit is contained in:
committed by
Armando Aguirre
parent
02dea6062f
commit
e816b95a87
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for w3c-xmlserializer 2.0
|
||||
// Project: https://github.com/jsdom/w3c-xmlserializer#readme
|
||||
// Definitions by: ExE Boss <https://github.com/ExE-Boss>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace serialize {
|
||||
interface Options {
|
||||
/**
|
||||
* Whether the serialization algorithm will throw an `Error`
|
||||
* when the `Node` can't be serialized to well-formed XML.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
requireWellFormed?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare function serialize(root: Node, options?: serialize.Options): string;
|
||||
export = serialize;
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es5", "dom"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"w3c-xmlserializer-tests.ts",
|
||||
"index.d.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,9 @@
|
||||
import serialize = require('w3c-xmlserializer');
|
||||
|
||||
serialize(document); // $ExpectType string
|
||||
serialize(document.documentElement); // $ExpectType string
|
||||
serialize(window); // $ExpectError
|
||||
|
||||
serialize(document, { requireWellFormed: true }); // $ExpectType string
|
||||
serialize(document.documentElement, { requireWellFormed: true }); // $ExpectType string
|
||||
serialize(window, { requireWellFormed: true }); // $ExpectError
|
||||
Reference in New Issue
Block a user