Create declaration file .d.ts for extensions submodule

This commit is contained in:
Faisal Salman
2023-11-30 11:12:28 +07:00
parent fdbeabbaed
commit e4f2463849
3 changed files with 21 additions and 5 deletions

View File

@@ -47,10 +47,12 @@ declare namespace UAParser {
}
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(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 class UAParser {
@@ -84,9 +86,9 @@ declare namespace UAParser {
};
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(extensions?: Record<string, RegexMap>, headers?: Record<string, string>);
constructor(extensions?: UAParserExt, headers?: Record<string, string>);
constructor(headers?: Record<string, string>);
getUA(): string;