postmanlabs / postman-app-support

Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.
https://www.postman.com
5.87k stars 841 forks source link

publish typescript type definitions for pre-request scripts #10940

Open DetachHead opened 2 years ago

DetachHead commented 2 years ago

Describe your current workflow

i am writing a fairly convoluted pre-request script which has led me to deciding to write in typescript and store it in a git repo. however, i can't seem to find any existing type definitions that match the pm object available in pre-request scripts. i found the types in postman-sandbox, however it seems to be outdated and missing quite a few things (such as pm.cookies.jar):

image image

i've attempted to fix some of the issues in https://github.com/postmanlabs/postman-sandbox/pull/826 but i'm not too familiar with the api so i had to do a lot of guessing. i'm not even sure if it's supposed to be the same as what's available in the postman tool itself or if it's supposed to be different

Describe your ideal workflow

i can write pre-request outside of postman and get the same typescript support as within postman, using the same type definitions that are available within the postman app

Describe alternatives you've considered

No response

Additional context

No response

DetachHead commented 2 years ago

so it turns out there were two problems:

however the types in postman-collection seem to be missing stuff like PropertyDefinition? https://github.com/DefinitelyTyped/DefinitelyTyped/blob/c432b1015151bc90947ea2ac3b1a50a86734ad0b/types/postman-collection/index.d.ts#L45