mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Update types of uri-templates to be up to date to new version. (#27559)
* Update types of uri templates. * Improve types. * Improve types in test.
This commit is contained in:
committed by
Sheetal Nandi
parent
67fea12e53
commit
ac91f0945d
Vendored
+7
-4
@@ -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 <https://github.com/Bartvds>
|
||||
// Bartek Szczepański <https://github.com/barnski>
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user