The CSSRule docs in MDN states that the CSSRule.type property is deprecated and is not clear to me what should be used instead if one wants to check the type of CSSRule. Adding some code for reference.
const isStyleOrImportRule = (rule: CSSRule): boolean => {
// 1 -> CSSRule.STYLE_RULE
// 3 -> CSSRule.IMPORT_RULE
return [1,3].includes(rule.type)
}