Repository navigation
Add: typings - #7
Conversation
|
|
||
| export function stringifyInfo( | ||
| value: any, | ||
| replacer?: ((this: any, key: string, value: any) => any) | undefined, |
There was a problem hiding this comment.
if a field is optional foo?: then there is no need | undefined
here and below
There was a problem hiding this comment.
Yes, I just only copy typing from JSON.stringify. Fixed
|
|
||
| export function parseChunked<T>(stream: Readable | Generator<any, void, unknown>): Promise<T>; | ||
|
|
||
| export function stringifyStream(value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): Readable; |
There was a problem hiding this comment.
lets move replacer function into a separate type to make code more clearer )
There was a problem hiding this comment.
Replacer accepts array of string and numbers either (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)
There was a problem hiding this comment.
| continueOnCircular?: boolean; | ||
| } | ||
| ): { | ||
| minLength: Number; |
| declare module '@discoveryjs/json-ext' { | ||
| import { Readable } from 'stream'; | ||
|
|
||
| export function parseChunked<T>(stream: Readable | Generator<any, void, unknown>): Promise<T>; |
There was a problem hiding this comment.
Function should return Promise<any>. It would be nice to add typings on generator w/o any/unknown if possible
cbfd163 to
1cf581f
Compare
| declare module '@discoveryjs/json-ext' { | ||
| import { Readable } from 'stream'; | ||
|
|
||
| type TReplacer = (this: any, key: string, value: any) => AnalyserNode; |
There was a problem hiding this comment.
Why AnalyserNode was used here?
| declare module '@discoveryjs/json-ext' { | ||
| import { Readable } from 'stream'; | ||
|
|
||
| type TReplacer = (this: any, key: string, value: any) => any; |
|
|
||
| type TReplacer = (this: any, key: string, value: any) => any; | ||
|
|
||
| export function parseChunked(stream: Readable | (() => AsyncGenerator<any, any, any>)): Promise<any>; |
There was a problem hiding this comment.
I think there should be something like:
export function parseChunked(input: Generator<string, never, void> | AsyncGenerator<string, never, void> | (() => (Iterable<string> | AsyncIterable<string>))): Promise<any>;a5709e0 to
7d9db70
Compare
|
LGTM |
|
@lahmatiy Cool, can you bump npm version? |
|
@lexich Done. Published as 0.5.4 |
|
@lexich My bad, 0.5.4 didn't contain |

No description provided.