diff --git a/google-libphonenumber/index.d.ts b/google-libphonenumber/index.d.ts index 4a0f865373..28f72f67a3 100644 --- a/google-libphonenumber/index.d.ts +++ b/google-libphonenumber/index.d.ts @@ -15,11 +15,21 @@ declare namespace libphonenumber { interface PhoneNumber { } + export module PhoneNumberUtil { + export enum ValidationResult { + IS_POSSIBLE, + INVALID_COUNTRY_CODE, + TOO_SHORT, + TOO_LONG + } + } + export class PhoneNumberUtil { static getInstance(): PhoneNumberUtil parse(number: string, region: string): PhoneNumber; isValidNumber(phoneNumber: PhoneNumber): boolean; isPossibleNumber(phoneNumber: PhoneNumber): boolean; + isPossibleNumberWithReason(phoneNumber: PhoneNumber): PhoneNumberUtil.ValidationResult; isValidNumberForRegion(phoneNumber: PhoneNumber, region: string): boolean; getRegionCodeForNumber(phoneNumber: PhoneNumber): string; isNANPACountry(regionCode: string): boolean; diff --git a/keymirror/index.d.ts b/keymirror/index.d.ts new file mode 100644 index 0000000000..1f2b6c01da --- /dev/null +++ b/keymirror/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for keymirror 0.1.1 +// Project: https://github.com/STRML/keyMirror +// Definitions by: Johannes Fahrenkrug +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function KeyMirror(obj: {}): { [key: string]: string }; +export = KeyMirror; diff --git a/keymirror/keymirror-tests.ts b/keymirror/keymirror-tests.ts new file mode 100644 index 0000000000..ace29f9947 --- /dev/null +++ b/keymirror/keymirror-tests.ts @@ -0,0 +1,3 @@ +import keyMirror = require('keymirror'); + +keyMirror({key1: null, key2: null}); diff --git a/keymirror/tsconfig.json b/keymirror/tsconfig.json new file mode 100644 index 0000000000..ce57da7581 --- /dev/null +++ b/keymirror/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "keymirror-tests.ts" + ] +} diff --git a/xml2js/index.d.ts b/xml2js/index.d.ts index e9d4e12ad0..0e180f7ba8 100644 --- a/xml2js/index.d.ts +++ b/xml2js/index.d.ts @@ -9,7 +9,7 @@ export = xml2js; declare namespace xml2js { function parseString(xml: string, callback: (err: any, result: any) => void): void; - function parseString(xml: string, options: Options, callback: (err: any, result: any) => void): void; + function parseString(xml: string, options: OptionsV2, callback: (err: any, result: any) => void): void; var defaults: { '0.1': Options; @@ -17,41 +17,15 @@ declare namespace xml2js { } class Builder { - constructor(options?: BuilderOptions); + constructor(options?: OptionsV2); buildObject(rootObj: any): string; } class Parser { - constructor(options?: Options); - processAsync(): any; - assignOrPush(obj: any, key: string, newValue: any): any; - reset(): any; + constructor(options?: OptionsV2); parseString(str: string, cb?: Function): void; } - interface RenderOptions { - indent?: string; - newline?: string; - pretty?: boolean; - } - - interface XMLDeclarationOptions { - encoding?: string; - standalone?: boolean; - version?: string; - } - - interface BuilderOptions { - doctype?: any; - headless?: boolean; - indent?: string; - newline?: string; - pretty?: boolean; - renderOpts?: RenderOptions; - rootName?: string; - xmldec?: XMLDeclarationOptions; - } - interface Options { async?: boolean; attrkey?: string; @@ -66,6 +40,7 @@ declare namespace xml2js { explicitChildren?: boolean; explicitRoot?: boolean; ignoreAttrs?: boolean; + includeWhiteChars?: boolean; mergeAttrs?: boolean; normalize?: boolean; normalizeTags?: boolean; @@ -96,3 +71,4 @@ declare namespace xml2js { cdata?: boolean; } } + diff --git a/xml2js/tsconfig.json b/xml2js/tsconfig.json index 61e4e5e52f..8e23bd3395 100644 --- a/xml2js/tsconfig.json +++ b/xml2js/tsconfig.json @@ -3,7 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -16,4 +16,4 @@ "index.d.ts", "xml2js-tests.ts" ] -} \ No newline at end of file +} diff --git a/xml2js/xml2js-tests.ts b/xml2js/xml2js-tests.ts index 3e3981156e..38306d9bb4 100644 --- a/xml2js/xml2js-tests.ts +++ b/xml2js/xml2js-tests.ts @@ -1,9 +1,35 @@ import xml2js = require('xml2js'); -xml2js.parseString("Hello xml2js!", (err: any, result: any) => { }); +xml2js.parseString('Hello xml2js!', (err: any, result: any) => { }); -xml2js.parseString("Hello xml2js!", {trim: true}, (err: any, result: any) => { }); +xml2js.parseString('Hello xml2js!', {trim: true}, (err: any, result: any) => { }); + +xml2js.parseString('Hello xml2js!', { + attrkey: '$', + charkey: '_', + explicitCharkey: false, + trim: false, + normalizeTags: false, + explicitRoot: true, + emptyTag: '', + explicitArray: true, + ignoreAttrs: false, + mergeAttrs: false, + validator: undefined, + xmlns: false, + explicitChildren: false, + childkey: '$$', + preserveChildrenOrder: false, + charsAsChildren: false, + includeWhiteChars: false, + async: false, + strict: true, + attrNameProcessors: undefined, + attrValueProcessors: undefined, + tagNameProcessors: undefined, + valueProcessors: undefined +}, (err: any, result: any) => { }); var builder = new xml2js.Builder({ renderOpts: { @@ -11,6 +37,23 @@ var builder = new xml2js.Builder({ } }); +var builder = new xml2js.Builder({ + rootName: 'root', + renderOpts: { + pretty: true, + indent: ' ', + newline: '\n' + }, + xmldec: { + version: '1.0', + encoding: 'UTF-8', + standalone: true + }, + doctype: { ext: 'hello.dtd' }, + headless: false, + cdata: false +}); + var outString = builder.buildObject({ 'hello': 'xml2js!' }); @@ -22,4 +65,5 @@ v1Defaults.async = true; var v2Defaults = xml2js.defaults['0.2']; v2Defaults.async = false; -v2Defaults.chunkSize = 20000; \ No newline at end of file +v2Defaults.chunkSize = 20000; +