@@ -327,6 +327,7 @@ export type ColorOption = {
327327 light : `#${string } `;
328328 dark : `#${string } `;
329329 } ;
330+ parsedColorOptionName : ParsedColorOptionName ;
330331} ;
331332
332333export const parseColorOptions = memoize ( ( rawCssCode : string ) : ColorOption [ ] => {
@@ -341,7 +342,7 @@ export const parseColorOptions = memoize((rawCssCode: string): ColorOption[] =>
341342
342343 assert ( node !== undefined ) ;
343344
344- const { declarations } = node as any ;
345+ const { declarations } = node as { declarations : any [ ] } ;
345346
346347 return { declarations } ;
347348 } ) ( ) ;
@@ -359,21 +360,22 @@ export const parseColorOptions = memoize((rawCssCode: string): ColorOption[] =>
359360 assert ( typeof colorDark === "string" ) ;
360361 assert ( cssColorRegexp . test ( colorDark ) , `${ colorDark } doesn't seem to be a color` ) ;
361362
362- const parsedName = parseColorOptionName ( property ) ;
363+ const parsedColorOptionName = parseColorOptionName ( property ) ;
363364
364- if ( parsedName . brightness . isInvariant ) {
365+ if ( parsedColorOptionName . brightness . isInvariant ) {
365366 assert ( colorLight === colorDark ) ;
366367 }
367368
368369 return {
369370 "colorOptionName" : property ,
370- "themePath" : getThemePath ( parsedName ) ,
371- "color" : parsedName . brightness . isInvariant
372- ? colorLight
371+ "themePath" : getThemePath ( parsedColorOptionName ) ,
372+ "color" : parsedColorOptionName . brightness . isInvariant
373+ ? ( colorLight as `#${ string } ` )
373374 : {
374- "light" : colorLight ,
375- "dark" : colorDark
376- }
375+ "light" : colorLight as `#${string } `,
376+ "dark" : colorDark as `#${string } `
377+ } ,
378+ parsedColorOptionName
377379 } ;
378380 } )
379381 . filter ( exclude ( undefined ) ) ;
0 commit comments