diff --git a/types/uri-templates/index.d.ts b/types/uri-templates/index.d.ts index ad8cead946..d378de8a4f 100644 --- a/types/uri-templates/index.d.ts +++ b/types/uri-templates/index.d.ts @@ -1,16 +1,19 @@ -// Type definitions for uri-templates 0.1.2 +// Type definitions for uri-templates 0.1.9 // Project: https://github.com/geraintluff/uri-templates // Definitions by: Bart van der Schoor +// Bartek SzczepaƄski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - declare function utpl(template: string): utpl.URITemplate; declare namespace utpl { export interface URITemplate { - fillFromObject(vars: Object): string; + fillFromObject(vars: { [key: string]: string }): string; fill(callback: (varName: string) => string): string; - fromUri(uri: string): Object; + fill(vars: { [key: string]: string }): string; + fromUri(uri: string): { [key: string]: string }; + varNames: string[]; + template: string; } } diff --git a/types/uri-templates/uri-templates-tests.ts b/types/uri-templates/uri-templates-tests.ts index 0aeb5e0bfe..d29b801de1 100644 --- a/types/uri-templates/uri-templates-tests.ts +++ b/types/uri-templates/uri-templates-tests.ts @@ -1,15 +1,23 @@ - import utmpl = require('uri-templates'); import URITemplate = utmpl.URITemplate; -var str: string; -var u: URITemplate; -var obj: Object; +let str: string; +let u: URITemplate; +const obj = { test: 'test1' }; u = utmpl(str); str = u.fillFromObject(obj); -str = u.fill((key) => { - return str; +str = u.fill(key => { + return str; }); -obj = u.fromUri(str); +str = u.fill(obj); +const newObj = u.fromUri(str); + +let varNames: string[]; + +varNames = u.varNames; + +let template: string; + +template = u.template;