diff --git a/index.d.ts b/index.d.ts index c6bc2f6..e776902 100644 --- a/index.d.ts +++ b/index.d.ts @@ -80,7 +80,7 @@ declare namespace LightMyRequest { trailers: { [key: string]: string } payload: string body: string - json: () => any + json: () => T cookies: Array } diff --git a/test/index.test-d.ts b/test/index.test-d.ts index 262b1aa..42b79e6 100644 --- a/test/index.test-d.ts +++ b/test/index.test-d.ts @@ -77,3 +77,6 @@ type ParsedValue = { field: string } const response: Response = await inject(dispatch) const parsedValue: ParsedValue = response.json() expectType(parsedValue) + +const parsedValueUsingGeneric = response.json() +expectType(parsedValueUsingGeneric)