@@ -10,7 +10,7 @@ class CustomDump {
1010 private readonly opts : yaml . DumpOptions ,
1111 ) { }
1212
13- represent ( ) {
13+ represent ( ) : string {
1414 let result = yaml . dump (
1515 this . data ,
1616 Object . assign ( { replacer, schema } , this . opts ) ,
@@ -35,7 +35,7 @@ const schema = yaml.DEFAULT_SCHEMA.extend({ implicit: [customDumpType] });
3535const isObject = ( value : unknown ) : value is object =>
3636 typeof value === "object" && value != null ;
3737
38- function hasSimpleChildren ( value : unknown ) {
38+ function hasSimpleChildren ( value : unknown ) : boolean {
3939 if ( isObject ( value ) ) {
4040 return Object . values ( value ) . every (
4141 ( value ) => ! isObject ( value ) && ! Array . isArray ( value ) ,
@@ -44,9 +44,10 @@ function hasSimpleChildren(value: unknown) {
4444 if ( Array . isArray ( value ) ) {
4545 return value . every ( ( value ) => ! isObject ( value ) && ! Array . isArray ( value ) ) ;
4646 }
47+ return false ;
4748}
4849
49- function replacer ( key : string , value : unknown ) {
50+ function replacer ( key : string , value : unknown ) : unknown {
5051 if ( key === "" ) {
5152 return value ;
5253 } // top-level, don't change this
@@ -58,6 +59,9 @@ function replacer(key: string, value: unknown) {
5859 return value ; // default
5960}
6061
61- export const serialize = ( obj : unknown ) =>
62- new CustomDump ( obj , { noRefs : true , quotingType : '"' } ) . represent ( ) . trim ( ) +
63- "\n" ;
62+ export function serialize ( obj : unknown ) : string {
63+ return (
64+ new CustomDump ( obj , { noRefs : true , quotingType : '"' } ) . represent ( ) . trim ( ) +
65+ "\n"
66+ ) ;
67+ }
0 commit comments