From 18c09354b93fc363753cf992ec7d31af24bbc266 Mon Sep 17 00:00:00 2001 From: Bart Veneman Date: Wed, 6 May 2026 15:31:11 +0200 Subject: [PATCH] chore: update use of deprecated `toMatchTypeOf` --- src/node-types.test.ts | 44 +++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/node-types.test.ts b/src/node-types.test.ts index cb0eeb8..5abee04 100644 --- a/src/node-types.test.ts +++ b/src/node-types.test.ts @@ -143,7 +143,7 @@ describe('type narrowing — compile-time', () => { test('is_stylesheet narrows type field', () => { const root = parse('a {}') if (is_stylesheet(root)) { - expectTypeOf(root).toMatchTypeOf() + expectTypeOf(root).toExtend() } }) @@ -151,9 +151,9 @@ describe('type narrowing — compile-time', () => { const root = parse('a { color: red }') const first = root.first_child! if (is_rule(first)) { - expectTypeOf(first).toMatchTypeOf() - expectTypeOf(first.prelude).toMatchTypeOf() - expectTypeOf(first.block).toMatchTypeOf() + expectTypeOf(first).toExtend() + expectTypeOf(first.prelude).toExtend() + expectTypeOf(first.block).toExtend() } }) @@ -161,17 +161,17 @@ describe('type narrowing — compile-time', () => { const root = parse('@media screen {}') const first = root.first_child! if (is_atrule(first)) { - expectTypeOf(first).toMatchTypeOf() + expectTypeOf(first).toExtend() expectTypeOf(first.name).toEqualTypeOf() - expectTypeOf(first.prelude).toMatchTypeOf() - expectTypeOf(first.block).toMatchTypeOf() + expectTypeOf(first.prelude).toExtend() + expectTypeOf(first.block).toExtend() } }) test('is_declaration narrows property, is_important, is_browserhack; omits inapplicable props', () => { const decl = parse_declaration('color: red !important') if (is_declaration(decl)) { - expectTypeOf(decl).toMatchTypeOf() + expectTypeOf(decl).toExtend() expectTypeOf(decl.property).toEqualTypeOf() expectTypeOf(decl.is_important).toEqualTypeOf() expectTypeOf(decl.is_browserhack).toEqualTypeOf() @@ -184,7 +184,7 @@ describe('type narrowing — compile-time', () => { const rule = root.first_child! as Rule const block = rule.block! if (is_block(block)) { - expectTypeOf(block).toMatchTypeOf() + expectTypeOf(block).toExtend() expectTypeOf(block.is_empty).toEqualTypeOf() } }) @@ -193,9 +193,9 @@ describe('type narrowing — compile-time', () => { const decl = parse_declaration('width: 100px') const dim = decl.first_child!.first_child! if (is_dimension(dim)) { - expectTypeOf(dim).toMatchTypeOf() - expectTypeOf(dim.value).toMatchTypeOf() - expectTypeOf(dim.unit).toMatchTypeOf() + expectTypeOf(dim).toExtend() + expectTypeOf(dim.value).toExtend() + expectTypeOf(dim.unit).toExtend() } }) @@ -203,8 +203,8 @@ describe('type narrowing — compile-time', () => { const decl = parse_declaration('z-index: 42') const num = decl.first_child!.first_child! if (is_number(num)) { - expectTypeOf(num).toMatchTypeOf() - expectTypeOf(num.value).toMatchTypeOf() + expectTypeOf(num).toExtend() + expectTypeOf(num.value).toExtend() } }) @@ -212,7 +212,7 @@ describe('type narrowing — compile-time', () => { const decl = parse_declaration('color: rgb(0,0,0)') const fn = decl.first_child!.first_child! if (is_function(fn)) { - expectTypeOf(fn).toMatchTypeOf() + expectTypeOf(fn).toExtend() expectTypeOf(fn.name).toEqualTypeOf() } }) @@ -221,7 +221,7 @@ describe('type narrowing — compile-time', () => { const root = parse_selector('[href]') const attr = root.first_child!.first_child! if (is_attribute_selector(attr)) { - expectTypeOf(attr).toMatchTypeOf() + expectTypeOf(attr).toExtend() expectTypeOf(attr.attr_operator).toEqualTypeOf() expectTypeOf(attr.attr_flags).toEqualTypeOf() } @@ -231,7 +231,7 @@ describe('type narrowing — compile-time', () => { const root = parse('@media (min-width: 768px) {}') const mediaFeature = (root.first_child! as Atrule).prelude!.first_child!.first_child! if (is_media_feature(mediaFeature)) { - expectTypeOf(mediaFeature).toMatchTypeOf() + expectTypeOf(mediaFeature).toExtend() expectTypeOf(mediaFeature.property).toEqualTypeOf() // `name` is absent on MediaFeature — verified by tsc } @@ -241,7 +241,7 @@ describe('type narrowing — compile-time', () => { const root = parse('@layer utilities;') const layer = (root.first_child! as Atrule).prelude!.first_child! if (is_layer_name(layer)) { - expectTypeOf(layer).toMatchTypeOf() + expectTypeOf(layer).toExtend() expectTypeOf(layer.name).toEqualTypeOf() } }) @@ -252,15 +252,15 @@ describe('type narrowing — compile-time', () => { const block = rule.block! // first_child on Block returns BlockChild, not the generic CSSNode const child = block.first_child - expectTypeOf(child).toMatchTypeOf() + expectTypeOf(child).toExtend() // next_sibling is narrowed to Raw | Declaration | Atrule | Rule, not CSSNode if (child.has_next) { - expectTypeOf(child.next_sibling).toMatchTypeOf() + expectTypeOf(child.next_sibling).toExtend() } // children[] and for-of also yield BlockChild - expectTypeOf(block.children[0]).toMatchTypeOf() + expectTypeOf(block.children[0]).toExtend() for (const c of block) { - expectTypeOf(c).toMatchTypeOf() + expectTypeOf(c).toExtend() } })