mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 17:20:09 +00:00
Merge pull request #34458 from keithlayne/ungap__url-search-params
Add types for @ungap/url-search-params
This commit is contained in:
29
types/ungap__url-search-params/index.d.ts
vendored
Normal file
29
types/ungap__url-search-params/index.d.ts
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
// Type definitions for @ungap/url-search-params 0.1
|
||||
// Project: https://github.com/ungap/url-search-params
|
||||
// Definitions by: Nick <https://github.com/nick121212>
|
||||
// Neha <https://github.com/nrathi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
/**
|
||||
* Based on definitions of lib.dom and lib.dom.iteralbe
|
||||
*/
|
||||
declare class URLSearchParams {
|
||||
constructor(init?: string[][] | Record<string, string> | string | URLSearchParams);
|
||||
|
||||
append(name: string, value: string): void;
|
||||
delete(name: string): void;
|
||||
get(name: string): string | null;
|
||||
getAll(name: string): string[];
|
||||
has(name: string): boolean;
|
||||
set(name: string, value: string): void;
|
||||
sort(): void;
|
||||
forEach(callbackfn: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any): void;
|
||||
[Symbol.iterator](): IterableIterator<[string, string]>;
|
||||
|
||||
entries(): IterableIterator<[string, string]>;
|
||||
keys(): IterableIterator<string>;
|
||||
values(): IterableIterator<string>;
|
||||
}
|
||||
|
||||
export = URLSearchParams;
|
||||
25
types/ungap__url-search-params/tsconfig.json
Normal file
25
types/ungap__url-search-params/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es5",
|
||||
"es6"
|
||||
],
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ungap__url-search-params-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/ungap__url-search-params/tslint.json
Normal file
3
types/ungap__url-search-params/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import URLSearchParams = require("url-search-params");
|
||||
|
||||
new URLSearchParams([["1", "2"]]);
|
||||
new URLSearchParams({ x: "y" });
|
||||
new URLSearchParams();
|
||||
new URLSearchParams(new URLSearchParams());
|
||||
|
||||
const params = new URLSearchParams("a=1&b=2");
|
||||
|
||||
params.append("b", "3");
|
||||
params.delete("a");
|
||||
params.delete("c");
|
||||
params.get("b");
|
||||
params.get("d");
|
||||
params.getAll("b");
|
||||
params.has("b");
|
||||
params.keys();
|
||||
params.set("b", "4");
|
||||
params.set("c", "5");
|
||||
params.toString();
|
||||
params.values();
|
||||
|
||||
params.forEach((value, key, params) => {
|
||||
const test: [string, string, URLSearchParams] = [value, key, params];
|
||||
});
|
||||
|
||||
for (const [key, value] of params) {
|
||||
const test: [string, string] = [key, value];
|
||||
}
|
||||
|
||||
for (const [key, value] of params.entries()) {
|
||||
const test: [string, string] = [key, value];
|
||||
}
|
||||
Reference in New Issue
Block a user