diff --git a/jsurl/jsurl-tests.ts b/jsurl/jsurl-tests.ts index f573feb49e..177399d346 100644 --- a/jsurl/jsurl-tests.ts +++ b/jsurl/jsurl-tests.ts @@ -1,8 +1,12 @@ /// -var u = new Url; // curent document URL will be used +interface U2Model { + a: any; +} + +var u = new Url (); // curent document URL will be used // or we can instantiate as -var u2 = new Url("http://example.com/some/path?a=b&c=d#someAnchor"); +var u2 = new Url("http://example.com/some/path?a=b&c=d#someAnchor"); // it should support relative URLs also var u3 = new Url("/my/site/doc/path?foo=bar#baz"); @@ -55,13 +59,13 @@ var str = 'My Cool Link'; // or use in DOM context var a = document.createElement('a'); -a.href = u; +a.href = u.toString(); a.innerHTML = 'test'; document.body.appendChild(a); // Stringify -u += ''; -String(u); -u.toString(); +var su1 = u + ''; +var su2 = String(u); +var su3 = u.toString(); // NOTE, that usually it will be done automatically, so only in special // cases direct stringify is required \ No newline at end of file diff --git a/jsurl/jsurl.d.ts b/jsurl/jsurl.d.ts index a5f7902578..2dbac988f7 100644 --- a/jsurl/jsurl.d.ts +++ b/jsurl/jsurl.d.ts @@ -1,11 +1,12 @@ -// Type definitions for jsurl 1.2.2 +// Type definitions for jsurl 1.2.7 // Project: https://github.com/Mikhus/jsurl // Definitions by: Alexey Gorshkov // Definitions: https://github.com/agorshkov23/DefinitelyTyped -declare class Url { - constructor(url?: string); - query: any; +declare class Url { + constructor(); + constructor(url: string); + query: T; protocol: string; user: string; pass: string; @@ -14,5 +15,5 @@ declare class Url { path: string; hash: string; href: string; - toString(): string; + toString: () => string; } \ No newline at end of file