@@ -41,13 +41,13 @@ function customSplit(str: string) {
4141
4242function splitFirst ( str : string , split : string ) {
4343 const index = str . indexOf ( split )
44- return [ str . slice ( 0 , index ) , str . slice ( index + 1 ) ]
44+ return [ str . slice ( 0 , index ) , str . slice ( index + 1 ) ] as const
4545}
4646
4747export function parseMetaString ( metaString : string ) {
4848 const inside = metaString . slice ( 1 , - 1 )
4949 const parts = customSplit ( inside )
50- const entries : [ string , any ] [ ] = [ ]
50+ const entries : [ string , string | string [ ] ] [ ] = [ ]
5151 for ( let i = 0 ; i < parts . length ; i ++ ) {
5252 const f = parts [ i ] !
5353 const [ key , val ] = splitFirst ( f , '=' )
@@ -56,11 +56,11 @@ export function parseMetaString(metaString: string) {
5656 for ( let j = 0 ; j < items . length ; j ++ ) {
5757 items [ j ] = items [ j ] ! . trim ( )
5858 }
59- entries . push ( [ key ! , items ] )
59+ entries . push ( [ key , items ] )
6060 } else if ( val && val . startsWith ( '"' ) && val . endsWith ( '"' ) ) {
61- entries . push ( [ key ! , val . slice ( 1 , - 1 ) ] )
61+ entries . push ( [ key , val . slice ( 1 , - 1 ) ] )
6262 } else {
63- entries . push ( [ key ! , val ] )
63+ entries . push ( [ key , val ] )
6464 }
6565 }
6666 return Object . fromEntries ( entries )
0 commit comments