mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
[accept-language-parser] Fix return type of pick() and add tests for return types
This commit is contained in:
parent
50ef506345
commit
470d41b9bc
@ -20,6 +20,6 @@ const l3: AcceptLanguageParser.Language = {
|
||||
quality: 0.9
|
||||
};
|
||||
|
||||
AcceptLanguageParser.parse('');
|
||||
AcceptLanguageParser.pick([''], '');
|
||||
AcceptLanguageParser.pick([''], [l1, l2, l3]);
|
||||
const parsed1: AcceptLanguageParser.Language[] = AcceptLanguageParser.parse('');
|
||||
const pick1: string | null = AcceptLanguageParser.pick([''], '');
|
||||
const pick2: string | null = AcceptLanguageParser.pick([''], [l1, l2, l3]);
|
||||
|
||||
2
types/accept-language-parser/index.d.ts
vendored
2
types/accept-language-parser/index.d.ts
vendored
@ -7,7 +7,7 @@
|
||||
// https://github.com/opentable/accept-language-parser/blob/v1.4.1/index.js
|
||||
|
||||
export function parse(acceptLanguage: string): Language[];
|
||||
export function pick(supportedLanguages: string[], acceptLanguage: string | Language[]): Language | null;
|
||||
export function pick(supportedLanguages: string[], acceptLanguage: string | Language[]): string | null;
|
||||
|
||||
export interface Language {
|
||||
code: string;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user