mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 16:08:47 +03:00
Create declaration file .d.ts for extensions submodule
This commit is contained in:
parent
fdbeabbaed
commit
e4f2463849
@ -183,7 +183,8 @@
|
|||||||
},
|
},
|
||||||
"./extensions": {
|
"./extensions": {
|
||||||
"require": "./src/extensions/ua-parser-extensions.js",
|
"require": "./src/extensions/ua-parser-extensions.js",
|
||||||
"import": "./src/extensions/ua-parser-extensions.mjs"
|
"import": "./src/extensions/ua-parser-extensions.mjs",
|
||||||
|
"types": "./src/extensions/ua-parser-extensions.d.ts"
|
||||||
},
|
},
|
||||||
"./helpers": {
|
"./helpers": {
|
||||||
"require": "./src/helpers/ua-parser-helpers.js",
|
"require": "./src/helpers/ua-parser-helpers.js",
|
||||||
|
13
src/extensions/ua-parser-extensions.d.ts
vendored
Normal file
13
src/extensions/ua-parser-extensions.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Type definitions for Helpers submodule of UAParser.js v2.0.0-beta.1
|
||||||
|
// Project: https://github.com/faisalman/ua-parser-js
|
||||||
|
// Definitions by: Faisal Salman <https://github.com/faisalman>
|
||||||
|
|
||||||
|
import type { UAParserExt } from "../main/ua-parser";
|
||||||
|
|
||||||
|
export const Apps: UAParserExt;
|
||||||
|
export const Bots: UAParserExt;
|
||||||
|
export const CLIs: UAParserExt;
|
||||||
|
export const ExtraDevices: UAParserExt;
|
||||||
|
export const Emails: UAParserExt;
|
||||||
|
export const MediaPlayers: UAParserExt;
|
||||||
|
export const Modules: UAParserExt;
|
10
src/main/ua-parser.d.ts
vendored
10
src/main/ua-parser.d.ts
vendored
@ -47,10 +47,12 @@ declare namespace UAParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RegexMap = ((RegExp | string | (string | RegExp | Function)[])[])[];
|
type RegexMap = ((RegExp | string | (string | RegExp | Function)[])[])[];
|
||||||
|
type UAParserProps = 'browser' | 'cpu' | 'device' | 'engine' | 'os';
|
||||||
|
type UAParserExt = Record<UAParserProps, RegexMap>;
|
||||||
|
|
||||||
export function UAParser(uastring?: string, extensions?: Record<string, RegexMap>, headers?: Record<string, string>): IResult;
|
export function UAParser(uastring?: string, extensions?: UAParserExt, headers?: Record<string, string>): IResult;
|
||||||
export function UAParser(uastring?: string, headers?: Record<string, string>): IResult;
|
export function UAParser(uastring?: string, headers?: Record<string, string>): IResult;
|
||||||
export function UAParser(extensions?: Record<string, RegexMap>, headers?: Record<string, string>): IResult;
|
export function UAParser(extensions?: UAParserExt, headers?: Record<string, string>): IResult;
|
||||||
export function UAParser(headers?: Record<string, string>): IResult;
|
export function UAParser(headers?: Record<string, string>): IResult;
|
||||||
|
|
||||||
export class UAParser {
|
export class UAParser {
|
||||||
@ -84,9 +86,9 @@ declare namespace UAParser {
|
|||||||
};
|
};
|
||||||
static readonly VERSION: string;
|
static readonly VERSION: string;
|
||||||
|
|
||||||
constructor(uastring?: string, extensions?: Record<string, RegexMap>, headers?: Record<string, string>);
|
constructor(uastring?: string, extensions?: UAParserExt, headers?: Record<string, string>);
|
||||||
constructor(uastring?: string, headers?: Record<string, string>);
|
constructor(uastring?: string, headers?: Record<string, string>);
|
||||||
constructor(extensions?: Record<string, RegexMap>, headers?: Record<string, string>);
|
constructor(extensions?: UAParserExt, headers?: Record<string, string>);
|
||||||
constructor(headers?: Record<string, string>);
|
constructor(headers?: Record<string, string>);
|
||||||
|
|
||||||
getUA(): string;
|
getUA(): string;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user