@@ -71,6 +71,8 @@ export function purify<T>(obj: T, options: SeriallOptions = {}): Pure[] {
7171 return obj2pures ( obj , contexts ) ;
7272}
7373
74+ export type StringifyFormatOptions = { format : 'json' | 'toml' | 'yaml' } ;
75+
7476/**
7577 * Serialize an object to a JSON string.
7678 * @param obj - The object to stringify.
@@ -79,7 +81,7 @@ export function purify<T>(obj: T, options: SeriallOptions = {}): Pure[] {
7981 */
8082export function stringify < T > (
8183 obj : T ,
82- options : SeriallOptions & { format ?: 'json' | 'toml' | 'yaml' } = { } ,
84+ options : SeriallOptions & Partial < StringifyFormatOptions > = { } ,
8385) : string {
8486 const contexts = parseSeriallOptions ( options ) ;
8587 const pures = obj2pures ( obj , contexts ) ;
@@ -114,11 +116,11 @@ export function parse<T>(str: Pure[], options?: SeriallOptions): T;
114116 */
115117export function parse < T > (
116118 str : string ,
117- options ?: SeriallOptions & { format ?: 'json' | 'toml' | 'yaml' } ,
119+ options ?: SeriallOptions & Partial < StringifyFormatOptions > ,
118120) : T ;
119121export function parse < T > (
120122 arg0 : Pure [ ] | string ,
121- options : SeriallOptions & { format ?: 'json' | 'toml' | 'yaml' } = { } ,
123+ options : SeriallOptions & Partial < StringifyFormatOptions > = { } ,
122124) : T {
123125 const contexts = parseSeriallOptions ( options ) ;
124126 if ( typeof arg0 === 'string' ) {
0 commit comments