DefinitelyTyped/types/libxslt/index.d.ts
ComFreek bc93f0695f libxmljs: add typings for latest version
Important changes of the v0.18 version:

- The previous libxmljs-tests.ts file used a require, thus made any
  variable from the imported 'libxmljs' typed 'any'. Hence, the test file
  actually tested no type declarations at all.
  This has been fixed via an ordinary 'import' statement.
- Enabled strict null checks in tsconfig.json
- Removed some exported classes (such as XMLDocument, HTMLDocument)
which are neither used nor exported anymore in more recent libxmljs versions.
- Added null return values to functions which sometimes return null,
  e.g. prevSibling(): Node|null.
2018-06-08 08:29:37 +02:00

38 lines
1.3 KiB
TypeScript

// Type definitions for node-libxslt 0.7
// Project: https://github.com/albanm/node-libxslt
// Definitions by: Alejandro Sánchez <https://github.com/alejo90>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import * as xmljs from 'libxmljs';
import {
ApplyCallback,
ApplyResult,
ApplyStringCallback,
OutputFormat,
ParseCallback
} from './internal-types';
export const libxmljs: typeof xmljs;
export interface ApplyOptions {
outputFormat?: OutputFormat;
noWrapParams?: boolean;
}
export interface Stylesheet {
apply(source: string, params?: object): string;
apply(source: string|xmljs.Document, params: object, options: ApplyOptions): ApplyResult;
apply(source: string|xmljs.Document, params: object, options: ApplyOptions, callback: ApplyCallback): void;
apply(source: string|xmljs.Document, callback: ApplyStringCallback): void;
apply(source: xmljs.Document, params?: object): xmljs.Document;
applyToFile(sourcePath: string, params: object, options: ApplyOptions, callback: ApplyStringCallback): void;
applyToFile(sourcePath: string, callback: ApplyStringCallback): void;
}
export function parse(source: string|xmljs.Document): Stylesheet;
export function parse(source: string|xmljs.Document, callback: ParseCallback): void;
export function parseFile(sourcePath: string, callback: ParseCallback): void;