From fd99d9184ecd3a5f3eb6560e4989533e77268332 Mon Sep 17 00:00:00 2001 From: Kyle Buzby Date: Sun, 11 Mar 2018 21:13:02 -0500 Subject: [PATCH] fix some todos --- types/postman-collection/index.d.ts | 6 +++--- .../postman-collection/postman-collection-tests.ts | 13 ++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/types/postman-collection/index.d.ts b/types/postman-collection/index.d.ts index a02953720a..ba8e0e581a 100644 --- a/types/postman-collection/index.d.ts +++ b/types/postman-collection/index.d.ts @@ -186,9 +186,9 @@ export class Collection extends ItemGroup { constructor(definition?: CollectionDefinition, environments?: any[]); - syncVariablesFrom(obj: any, track?: boolean): any; + syncVariablesFrom(obj: {[key: string]: VariableDefinition}, track?: boolean, prune?: boolean): {created: string[], updated: string[], deleted: string[]} | undefined; - syncVariablesTo(obj: any): any; + syncVariablesTo(obj?: {[key: string]: VariableDefinition}): {[key: string]: VariableDefinition}; toJSON(): CollectionDefinition; @@ -466,7 +466,7 @@ export class Request extends Property implements RequestDefin removeHeader(toRemove: string | Header, options?: {ignoreCase: boolean}): void; - removeQueryParams(params: string | string[] | QueryParamDefinition[]): void; + removeQueryParams(params: string | string[] | QueryParamDefinition[] | QueryParamDefinition): void; toJSON(): RequestDefinition; diff --git a/types/postman-collection/postman-collection-tests.ts b/types/postman-collection/postman-collection-tests.ts index 4e7cd41263..2574aa5917 100644 --- a/types/postman-collection/postman-collection-tests.ts +++ b/types/postman-collection/postman-collection-tests.ts @@ -164,13 +164,12 @@ collection = new pmCollection.Collection({}, []); collection.events; // $ExpectType EventList collection.variables; // $ExpectType VariableList collection.version; // $ExpectType Version | undefined -// TODO update when get to VariableList -collection.syncVariablesFrom({}); // $ExpectType any -// TODO update -collection.syncVariablesFrom({}, true); // ExpectType any -// TODO update -collection.syncVariablesTo({}); // ExpectType any +collection.syncVariablesFrom({}); // $ExpectType { created: string[]; updated: string[]; deleted: string[]; } | undefined +collection.syncVariablesFrom({}, true); // $ExpectType { created: string[]; updated: string[]; deleted: string[]; } | undefined + +collection.syncVariablesTo({}); // ExpectType $ExpectType { [key: string]: VariableDefinition; } + collection.toJSON(); // $ExpectType CollectionDefinition pmCollection.Collection.isCollection(collection); // $ExpectType boolean @@ -492,10 +491,10 @@ req.upsertHeader(headerDef); // $ExpectType void req.addQueryParams("string"); // $ExpectType void req.addQueryParams([qpDef]); // $ExpectType void -// TODO check these - they might also need plain qpDef as a parameter req.removeQueryParams("string"); // $ExpectType void req.removeQueryParams(["string"]); // $ExpectType void req.removeQueryParams([qpDef]); // $ExpectType void +req.removeQueryParams(qpDef); // $ExpectType void req.toJSON(); // $ExpectType RequestDefinition