mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-29 08:58:23 +08:00
fixed
jsurl/jsurl-tests.ts(16,7): error TS7017: Index signature of object type implicitly has an 'any' type.
This commit is contained in:
@@ -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
4
jsurl/jsurl.d.ts
vendored
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user