* Distinguish request and response data types
* Fix Axios headers type
`axios.headers` is not of the same type as `request.headers`, so a new type
`AxiosDefaults` was introduced
* Replace grunt-ts with dtslint
This asserts that the type definitions are valid in the specified TypeScript
version and above. This is the same tool that is used by DefinitelyTyped.
* Remove grunt-ts
* Restore typescript dependency
* Fix missing semicolons
Co-authored-by: Claas Augner <github@caugner.de>
Co-authored-by: Jay <jasonsaayman@gmail.com>
This requires TypeScript users to explicitly define the type of the data they
are consuming.
Before this, data was `any` by default. This means TypeScript consumers didn’t
get type safety if they forgot to specify the type.
Technically this is a breaking change for TypeScript users, as this will report
errors if they forgot to specifiy the response type. The simplest workaround
would be to explicitly set the response type to `any`, so it’s not breaking
much.
The `unknown` type is probably a slightly better fit, but this requires
TypeScript ^3.
`data` is still `any` in the very specific use case mentioned in
https://github.com/microsoft/TypeScript/issues/38969
Co-authored-by: Jay <jasonsaayman@gmail.com>
* Improved type-safety for AxiosRequestConfig
- AxiosRequestConfig is now a generic type whose template corresponds to data
Signed-off-by: Carlos Chida <carlos.chida@starchitecture.eu>
* Fixed tests
- TS tests now match the behaviour described in the PR
Signed-off-by: Carlos Chida <carlos.chida@starchitecture.eu>
Co-authored-by: Jay <jasonsaayman@gmail.com>