DefinitelyTyped/types/supertest
Ryspekov Ansar b4f5587ed2
🤖 Merge PR #45707 @types/supertest: Type declaration for agent() return type by @RayDarar
* Type declaration for agent() return type

## The case

In my project, it is essential to always clarify the variable type. In my case, writing a test suite would require to declare variables (so that they could be accessed in other scopes) and then later initialize them in a different block

## An example

```ts
describe("Health module", () => {
  // In this case I must declare variables here
  let app: NestApplication;
  let agent: any; // I could just copy and paste that huge return type, but it will break the code style. Using `any` is also a bad practice I guess

  beforeAll(() => {
    /* some code */
    // initialization goes here
   agent = supertest.agent(app.getHttpServer());
  });
  /* some code */
});
```
## Proposal

Declaring the return type of the agent function would be great, however, considering that I'm new to this library there may be a type declared already.

P.S. `SuperTestAgent` is just the first thing that I could come up with, it should be named more properly

* running lint
2020-06-29 10:13:15 -07:00
..
index.d.ts
supertest-tests.ts
tsconfig.json
tslint.json