From cb92a8d7a6f8014e0945a23aa76b17997f94684a Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Mon, 14 Mar 2022 02:04:04 +0530 Subject: [PATCH] fix: add type extensions to postman-collection types --- .../hoppscotch-app/types/pm-coll-exts.d.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 packages/hoppscotch-app/types/pm-coll-exts.d.ts diff --git a/packages/hoppscotch-app/types/pm-coll-exts.d.ts b/packages/hoppscotch-app/types/pm-coll-exts.d.ts new file mode 100644 index 000000000..c23b22e99 --- /dev/null +++ b/packages/hoppscotch-app/types/pm-coll-exts.d.ts @@ -0,0 +1,21 @@ +import "postman-collection" + +/* + There are some small mismatches in some types that the 'postman-collection' + package provides (come on guys ;) ). These type definitions append extra + information which is present in the runtime values of the types +*/ + +type PMRawLanguage = "text" | "javascript" | "json" | "html" | "xml" + +declare module "postman-collection" { + interface RequestBody { + // Options is not well-defined by the schema, so we are treating everything as optional for runtime safety. + // See: https://schema.postman.com/collection/json/v2.1.0/draft-04/collection.json + options?: { + raw?: { + language?: PMRawLanguage + } + } + } +}