1
- import type { Node , ChildProps , Container , Root } from "postcss" ;
1
+ import type { Container , Node , Root } from "postcss" ;
2
2
import type { Locations } from "./common" ;
3
3
import type { SvelteStyleElement } from "./html" ;
4
4
5
- type ESLintCompatiblePostCSSContainer <
6
- PostCSSNode extends Node ,
7
- Child extends Node
8
- > = {
9
- each (
10
- callback : (
11
- node : ESLintCompatiblePostCSSNode < Child > ,
12
- index : number
13
- ) => false | void
14
- ) : false | undefined ;
15
- every (
16
- condition : (
17
- node : ESLintCompatiblePostCSSNode < Child > ,
18
- index : number ,
19
- nodes : ESLintCompatiblePostCSSNode < Child > [ ]
20
- ) => boolean
21
- ) : boolean ;
22
- get first ( ) : ESLintCompatiblePostCSSNode < Child > | undefined ;
23
- index ( child : ESLintCompatiblePostCSSNode < Child > | number ) : number ;
24
- insertAfter (
25
- oldNode : ESLintCompatiblePostCSSNode < Child > | number ,
26
- newNode :
27
- | ESLintCompatiblePostCSSNode < Child >
28
- | ChildProps
29
- | string
30
- | ESLintCompatiblePostCSSNode < Child > [ ]
31
- | ChildProps [ ]
32
- | string [ ]
33
- ) : ESLintCompatiblePostCSSNode < PostCSSNode > ;
34
- insertBefore (
35
- oldNode : ESLintCompatiblePostCSSNode < Child > | number ,
36
- newNode :
37
- | ESLintCompatiblePostCSSNode < Child >
38
- | ChildProps
39
- | string
40
- | ESLintCompatiblePostCSSNode < Child > [ ]
41
- | ChildProps [ ]
42
- | string [ ]
43
- ) : ESLintCompatiblePostCSSNode < PostCSSNode > ;
44
- get last ( ) : ESLintCompatiblePostCSSNode < Child > | undefined ;
45
- nodes : ESLintCompatiblePostCSSNode < Child > [ ] ;
46
- push (
47
- child : ESLintCompatiblePostCSSNode < Child >
48
- ) : ESLintCompatiblePostCSSNode < PostCSSNode > ;
49
- removeChild (
50
- child : ESLintCompatiblePostCSSNode < Child > | number
51
- ) : ESLintCompatiblePostCSSNode < PostCSSNode > ;
52
- some (
53
- condition : (
54
- node : ESLintCompatiblePostCSSNode < Child > ,
55
- index : number ,
56
- nodes : ESLintCompatiblePostCSSNode < Child > [ ]
57
- ) => boolean
58
- ) : boolean ;
5
+ type ESLintCompatiblePostCSSContainer < Child extends Node > = Omit <
6
+ Container < ESLintCompatiblePostCSSNode < Child > > ,
7
+ "parent" | "type" | "walk"
8
+ > & {
59
9
walk (
60
10
callback : (
61
11
node : ESLintCompatiblePostCSSNode < Child > ,
@@ -68,26 +18,10 @@ export type ESLintCompatiblePostCSSNode<PostCSSNode extends Node> =
68
18
// The following hack makes the `type` property work for type narrowing, see microsoft/TypeScript#53887.
69
19
PostCSSNode extends any
70
20
? Locations &
71
- Omit <
72
- PostCSSNode ,
73
- | "parent"
74
- | "type"
75
- | "each"
76
- | "every"
77
- | "first"
78
- | "index"
79
- | "insertAfter"
80
- | "insertBefore"
81
- | "last"
82
- | "nodes"
83
- | "push"
84
- | "removeChild"
85
- | "some"
86
- | "walk"
87
- > & {
21
+ Omit < PostCSSNode , "parent" | "type" | "walk" > & {
88
22
type : `SvelteStyle-${PostCSSNode [ "type" ] } `;
89
23
} & ( PostCSSNode extends Container < infer Child >
90
- ? ESLintCompatiblePostCSSContainer < PostCSSNode , Child >
24
+ ? ESLintCompatiblePostCSSContainer < Child >
91
25
: unknown ) &
92
26
( PostCSSNode extends Root
93
27
? {
0 commit comments