Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix: add type extensions to postman-collection types

Andrew Bastincb92a8d7a6f8
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
+ }
+ }
+ }
+}