jsurl/jsurl-tests.ts(16,7): error TS7017: Index signature of object type implicitly has an 'any' type.
This commit is contained in:
Alexey Gorshkov
2016-01-03 02:13:24 +03:00
parent 6259fa1e5b
commit 4de193b136
2 changed files with 12 additions and 3 deletions

View File

@@ -1,10 +1,15 @@
/// <reference path="jsurl.d.ts" />
interface U2Model {
interface UModel extends UrlQuery {
a: any;
b: string;
}
interface U2Model extends UrlQuery {
a: any;
}
var u = new Url <any>(); // curent document URL will be used
var u = new Url<UModel>(); // curent document URL will be used
// or we can instantiate as
var u2 = new Url<U2Model>("http://example.com/some/path?a=b&c=d#someAnchor");
// it should support relative URLs also
@@ -48,7 +53,7 @@ alert(
'path = ' + u.path + '\n' +
'query = ' + u.query + '\n' +
'hash = ' + u.hash
);
);
// Manipulating URL parts
u.path = '/some/new/path'; // the way to change URL path

4
jsurl/jsurl.d.ts vendored
View File

@@ -3,6 +3,10 @@
// Definitions by: Alexey Gorshkov <https://github.com/agorshkov23>
// Definitions: https://github.com/agorshkov23/DefinitelyTyped
interface UrlQuery {
clear: () => void;
}
declare class Url<T> {
constructor();
constructor(url: string);