Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions pkgs/typed-api-spec/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,21 @@ export {
import FetchT, { RequestInitT } from "./fetch";
export { FetchT, RequestInitT };

import JSONT, { JSON$stringifyT } from "./json";
export { JSONT, JSON$stringifyT };
import JSONT, {
JSON$stringifyT,
TypedString,
JsonStringifyResult,
Jsonify,
JsonifyObject,
} from "./json";
export {
JSONT,
JSON$stringifyT,
TypedString,
JsonStringifyResult,
Jsonify,
JsonifyObject,
};

export {
newHttp as newMswHttp,
Expand Down
4 changes: 2 additions & 2 deletions pkgs/typed-api-spec/src/json/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type JsonPrimitive = string | number | boolean | null | Date;
// eslint-disable-next-line @typescript-eslint/ban-types
type InvalidJsonValue = undefined | Function | symbol | bigint;

type JsonifyObject<T> = {
export type JsonifyObject<T> = {
[K in keyof T as K extends string
? T[K] extends InvalidJsonValue
? never
Expand All @@ -39,7 +39,7 @@ type JsonifyTuple<T extends readonly unknown[]> = T extends [
]
: [];

type Jsonify<T> = T extends { toJSON(): infer R }
export type Jsonify<T> = T extends { toJSON(): infer R }
? Jsonify<R>
: T extends Date
? string
Expand Down