Skip to content

Commit 97ab9d7

Browse files
committed
rename some types
1 parent 32acb35 commit 97ab9d7

File tree

7 files changed

+120
-123
lines changed

7 files changed

+120
-123
lines changed

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ export { NODE_TYPES } from './constants'
3434

3535
// Node subtypes and type predicate functions
3636
export {
37-
type CssNodeCommon as CSSNode,
37+
type CSSNode,
3838
type WithChildren,
39-
type AnyCss,
39+
type AnyNode,
4040
type ToPlain,
4141
type StyleSheet,
4242
type Rule,

src/node-types.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
is_layer_name,
2222
} from './node-types'
2323
import type {
24-
AnyCss,
24+
AnyNode,
2525
StyleSheet,
2626
Rule,
2727
Atrule,
@@ -244,7 +244,7 @@ describe('type narrowing — compile-time', () => {
244244
it('AnyCss enables switch narrowing', () => {
245245
// This test verifies the discriminated union works for switch narrowing.
246246
// The function must compile without type errors.
247-
function extract_name(node: AnyCss): string | undefined {
247+
function extract_name(node: AnyNode): string | undefined {
248248
switch (node.type) {
249249
case 3: // AT_RULE
250250
return node.name // must be string here
@@ -255,10 +255,10 @@ describe('type narrowing — compile-time', () => {
255255
}
256256
}
257257
const root = parse('@media screen {}')
258-
const atrule = root.first_child! as AnyCss
258+
const atrule = root.first_child! as AnyNode
259259
expect(extract_name(atrule)).toBe('media')
260260

261-
const decl = parse_declaration('color: red') as AnyCss
261+
const decl = parse_declaration('color: red') as AnyNode
262262
expect(extract_name(decl)).toBe('color')
263263
})
264264
})

0 commit comments

Comments
 (0)