hey I am tryin to tackle Wrong hint for step 24 of Cafe Menu project · Issue #45919 · freeCodeCamp/freeCodeCamp (github.com)
my code,
Edit: I have added Array<string>, because I changed find function to filter function in getStyle method
interface ExtendedStyleDeclaration extends CSSStyleDeclaration {
getPropVal: (prop: string | Array<string>, strip?: boolean) => string;
}
getStyle(selector: string): ExtendedStyleDeclaration | null {
const style = this._getStyleRules().filter( <-----
ele => ele?.selectorText === selector
)?.style as ExtendedStyleDeclaration |undefined;
if (!style) return null;
style.getPropVal = (prop: string | Array<string>, strip = false) => {
return strip
? style.getPropertyValue(prop).replace(/\s+/g, '')
: style.getPropertyValue(prop);
};
return style;
}
the errors:
-
Property 'style' does not exist on type 'CSSStyleRule[]'. -
"Argument of type 'string | string[]' is not assignable to parameter of type 'string'.\n Type 'string[]' is not assignable to type 'string'."