mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
Merge pull request #30023 from davecardwell/browserslist
[browserslist] Add initial types for browserslist
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import browserslist from "browserslist";
|
||||
|
||||
browserslist(); // $ExpectType string[]
|
||||
browserslist(""); // $ExpectType string[]
|
||||
browserslist([""]); // $ExpectType string[]
|
||||
|
||||
const opts: browserslist.Options[] = [
|
||||
{},
|
||||
{ path: "" },
|
||||
{ env: "" },
|
||||
{ stats: { "": { "": 0 } } },
|
||||
{ config: "" },
|
||||
{ ignoreUnknownVersions: false },
|
||||
{ dangerousExtend: false }
|
||||
];
|
||||
for (const opt of opts) {
|
||||
browserslist("", opt); // $ExpectType string[]
|
||||
browserslist([""], opt); // $ExpectType string[]
|
||||
}
|
||||
|
||||
browserslist.coverage([""]); // $ExpectType number
|
||||
browserslist.coverage([""], { "": { "": 0 } }); // $ExpectType number
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for browserslist 4.3
|
||||
// Project: https://github.com/browserslist/browserslist#readme
|
||||
// Definitions by: Dave Cardwell <https://github.com/davecardwell>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
declare namespace browserslist {
|
||||
interface Browserslist {
|
||||
(queries?: string | ReadonlyArray<string>, opts?: Options): string[];
|
||||
|
||||
coverage: (browsers: ReadonlyArray<string>, stats?: Stats) => number;
|
||||
|
||||
clearCaches: () => void;
|
||||
}
|
||||
|
||||
interface Stats {
|
||||
[browser: string]: {
|
||||
[version: string]: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface Options {
|
||||
path?: string;
|
||||
env?: string;
|
||||
stats?: Stats;
|
||||
config?: string;
|
||||
ignoreUnknownVersions?: boolean;
|
||||
dangerousExtend?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare var browserslist: browserslist.Browserslist;
|
||||
|
||||
export = browserslist;
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": ["index.d.ts", "browserslist-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user