Skip to content

Commit 7ab2837

Browse files
committed
Expose internal TypeScript types such as options and return types
1 parent d7ac949 commit 7ab2837

2 files changed

Lines changed: 14 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- `parseChunked()`:
44
- Added `returnValue` and `currentRootValue` properties to the state object passed to `onChunk` and `onRootValue` callbacks
5+
- Exposed internal TypeScript types such as options and return types of public functions as part of the public API
56

67
## 1.0.0 (2026-03-09)
78

index.d.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
declare module '@discoveryjs/json-ext' {
2-
type Chunk = string | Uint8Array | Buffer;
2+
export type Chunk = string | Uint8Array | Buffer;
33

4-
type Reviver = (this: any, key: string, value: any) => any;
5-
type ParseChunkedState = {
4+
export type Reviver = (this: any, key: string, value: any) => any;
5+
export type ParseChunkedState = {
66
readonly mode: 'json' | 'jsonl';
77
readonly returnValue: any;
88
readonly currentRootValue: any;
99
readonly rootValuesCount: number;
1010
readonly consumed: number;
1111
readonly parsed: number;
1212
};
13-
type OnRootValue = (value: any, state: ParseChunkedState) => void;
14-
type OnChunk = (chunkParsed: number, chunk: string | null, pending: string | null, state: ParseChunkedState) => void;
15-
type ParseOptions = {
13+
export type OnRootValue = (value: any, state: ParseChunkedState) => void;
14+
export type OnChunk = (chunkParsed: number, chunk: string | null, pending: string | null, state: ParseChunkedState) => void;
15+
export type ParseOptions = {
1616
reviver?: Reviver;
1717
mode?: 'json' | 'jsonl' | 'auto';
1818
onRootValue?: OnRootValue;
1919
onChunk?: OnChunk;
2020
};
2121

22-
type Replacer =
22+
export type Replacer =
2323
| ((this: any, key: string, value: any) => any)
2424
| (string | number)[]
2525
| null;
26-
type Space = string | number | null;
27-
type StringifyOptions = {
26+
export type Space = string | number | null;
27+
export type StringifyOptions = {
2828
replacer?: Replacer;
2929
space?: Space;
3030
mode?: 'json' | 'jsonl';
3131
highWaterMark?: number;
32-
}
33-
type StringifyInfoOptions = {
32+
};
33+
export type StringifyInfoOptions = {
3434
replacer?: Replacer;
3535
space?: Space;
3636
mode?: 'json' | 'jsonl';
3737
continueOnCircular?: boolean;
38-
}
39-
type StringifyInfoResult = {
38+
};
39+
export type StringifyInfoResult = {
4040
bytes: number;
4141
spaceBytes: number;
4242
circular: object[];

0 commit comments

Comments
 (0)