Skip to content
Myr

refactor(types): remove SimplifyDeepArray from json types (#4406)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jonathan Haines · committed by GitHub · parent f8c9b6e · Browse files · 1 file+6 added−12 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−12 removed

  • other:+6 added−12 removed

1 file+6 added−12 removed

modified:src/context.ts+6 added-12 removed
11 unmodified lines
12import type { ResponseHeader } from './utils/headers'13import { HtmlEscapedCallbackPhase, resolveCallback } from './utils/html'14import type { ContentfulStatusCode, RedirectStatusCode, StatusCode } from './utils/http-status'15import type { BaseMime } from './utils/mime'16import type {17 InvalidJSONValue,18 IsAny,19 JSONParsed,20 JSONValue,21 SimplifyDeepArray,22} from './utils/types'16import type { InvalidJSONValue, IsAny, JSONParsed, JSONValue } from './utils/types'1718type HeaderRecord =19 | Record<'Content-Type', BaseMime>20 | Record<ResponseHeader, string | string[]>
146 unmodified lines
167 * @returns {JSONRespondReturn<T, U>} - The response after rendering the JSON object, typed with the provided object and status code types.168 */169interface JSONRespond {170 <177 T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue,171 T extends JSONValue | {} | InvalidJSONValue,172 U extends ContentfulStatusCode = ContentfulStatusCode173 >(174 object: T,175 status?: U,176 headers?: HeaderRecord177 ): JSONRespondReturn<T, U>178 <185 T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue,179 T extends JSONValue | {} | InvalidJSONValue,180 U extends ContentfulStatusCode = ContentfulStatusCode181 >(182 object: T,183 init?: ResponseOrInit<U>
5 unmodified lines
189 * @template U - The type of the status code.190 *191 * @returns {Response & TypedResponse<JSONParsed<T>, U, 'json'>} - The response after rendering the JSON object, typed with the provided object and status code types.192 */199type JSONRespondReturn<200 T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue,193export type JSONRespondReturn<194 T extends JSONValue | {} | InvalidJSONValue,195 U extends ContentfulStatusCode196> = Response & TypedResponse<JSONParsed<T>, U, 'json'>197198/**
489 unmodified lines
688 * })689 * ```690 */691 json: JSONRespond = <698 T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue,692 T extends JSONValue | {} | InvalidJSONValue,693 U extends ContentfulStatusCode = ContentfulStatusCode694 >(695 object: T,696 arg?: U | ResponseOrInit<U>,
67 unmodified lines