interface ListOf < TNode > { length : number ; [ index ] : TNode ; } export const toArray = < T > ( a ) : T [ ] => { const ret = Array ( a . length ) ; for ( let i = 0 ; i < a . length ; ++ i ) { ret [ i ] = a [ i ] ; } return ret ; } ; export const asArray = < T > ( a ) : T [ ] => ( Array . isArray ( a ) ? a : [ a ] ) ;