Skip to content

Commit 2bf2125

Browse files
committed
Removed uneeded re-implementation of postcss Container
1 parent 832cbdc commit 2bf2125

File tree

1 file changed

+7
-73
lines changed

1 file changed

+7
-73
lines changed

Diff for: src/ast/style.ts

+7-73
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,11 @@
1-
import type { Node, ChildProps, Container, Root } from "postcss";
1+
import type { Container, Node, Root } from "postcss";
22
import type { Locations } from "./common";
33
import type { SvelteStyleElement } from "./html";
44

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+
> & {
599
walk(
6010
callback: (
6111
node: ESLintCompatiblePostCSSNode<Child>,
@@ -68,26 +18,10 @@ export type ESLintCompatiblePostCSSNode<PostCSSNode extends Node> =
6818
// The following hack makes the `type` property work for type narrowing, see microsoft/TypeScript#53887.
6919
PostCSSNode extends any
7020
? 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"> & {
8822
type: `SvelteStyle-${PostCSSNode["type"]}`;
8923
} & (PostCSSNode extends Container<infer Child>
90-
? ESLintCompatiblePostCSSContainer<PostCSSNode, Child>
24+
? ESLintCompatiblePostCSSContainer<Child>
9125
: unknown) &
9226
(PostCSSNode extends Root
9327
? {

0 commit comments

Comments
 (0)