mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
parse-prefer-header: More specific typings (#42642)
* parse-prefer-header: Allow null or undefined input * parse-prefer-header: More explicit return value typing * parse-prefer-header: amend contributor list * parse-prefer-header: Support ReadonlyArray argument * parse-prefer-header: Add separate tests for Array and ReadonlyArray
This commit is contained in:
4
types/parse-prefer-header/index.d.ts
vendored
4
types/parse-prefer-header/index.d.ts
vendored
@@ -1,8 +1,8 @@
|
||||
// Type definitions for parse-prefer-header 1.0
|
||||
// Project: https://github.com/ppaskaris/node-parse-prefer-header
|
||||
// Definitions by: Vincenzo Chianese <https://github.com/XVincentX>
|
||||
// Definitions by: Vincenzo Chianese <https://github.com/XVincentX>, Marcell Toth <https://github.com/marcelltoth>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function parsePreferHeader(preferHeader: string | string[]): { [key: string]: string | boolean };
|
||||
declare function parsePreferHeader(preferHeader: string | ReadonlyArray<string> | null | undefined): { [key: string]: string | true };
|
||||
|
||||
export = parsePreferHeader;
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
import parsePreferHeader = require('parse-prefer-header');
|
||||
|
||||
parsePreferHeader(['respond-async, wait=100', 'handling=lenient']);
|
||||
const testArray = ['respond-async, wait=100', 'handling=lenient'];
|
||||
|
||||
const readonlyTestArray: ReadonlyArray<string> = testArray;
|
||||
|
||||
parsePreferHeader(testArray);
|
||||
parsePreferHeader(readonlyTestArray);
|
||||
parsePreferHeader('');
|
||||
parsePreferHeader(null);
|
||||
parsePreferHeader(undefined);
|
||||
|
||||
Reference in New Issue
Block a user