diff --git a/pkg/sass-parser/lib/src/postcss.d.ts b/pkg/sass-parser/lib/src/postcss.d.ts index 5e9bf293a..e7732caf4 100644 --- a/pkg/sass-parser/lib/src/postcss.d.ts +++ b/pkg/sass-parser/lib/src/postcss.d.ts @@ -4,16 +4,4 @@ import * as postcss from 'postcss'; -declare module 'postcss' { - interface Container { - // We need to be able to override this and call it as a super method. - // TODO - postcss/postcss#1957: Remove this - /** @hidden */ - normalize( - node: string | postcss.ChildProps | postcss.Node, - sample: postcss.Node | undefined - ): Child[]; - } -} - export const isClean: unique symbol; diff --git a/pkg/sass-parser/lib/src/statement/at-rule-internal.d.ts b/pkg/sass-parser/lib/src/statement/at-rule-internal.d.ts index 0cff547e9..eacc3eefe 100644 --- a/pkg/sass-parser/lib/src/statement/at-rule-internal.d.ts +++ b/pkg/sass-parser/lib/src/statement/at-rule-internal.d.ts @@ -15,7 +15,7 @@ import {AtRule, ChildNode, ChildProps, Comment, Declaration, NewNode} from '.'; * @hidden */ export class _AtRule< - Props extends Partial, + Props > extends postcss.AtRule { declare nodes: ChildNode[]; @@ -36,21 +36,13 @@ export class _AtRule< every( condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean ): boolean; - index(child: ChildNode | number): number; - insertAfter(oldNode: ChildNode | number, newNode: NewNode): this; - insertBefore(oldNode: ChildNode | number, newNode: NewNode): this; + insertAfter(oldNode: postcss.ChildNode | number, newNode: NewNode): this; + insertBefore(oldNode: postcss.ChildNode | number, newNode: NewNode): this; next(): ChildNode | undefined; prepend(...nodes: NewNode[]): this; prev(): ChildNode | undefined; - push(child: ChildNode): this; - removeChild(child: ChildNode | number): this; replaceWith( - ...nodes: ( - | postcss.Node - | ReadonlyArray - | ChildProps - | ReadonlyArray - )[] + ...nodes: NewNode[] ): this; root(): Root; some( diff --git a/pkg/sass-parser/lib/src/statement/index.ts b/pkg/sass-parser/lib/src/statement/index.ts index 0f0b79366..4a8df7f15 100644 --- a/pkg/sass-parser/lib/src/statement/index.ts +++ b/pkg/sass-parser/lib/src/statement/index.ts @@ -63,7 +63,7 @@ export type ChildProps = postcss.ChildProps | RuleProps | GenericAtRuleProps; * @category Statement */ export interface ContainerProps extends NodeProps { - nodes?: (postcss.Node | ChildProps)[]; + nodes?: ReadonlyArray; } /** @@ -71,7 +71,7 @@ export interface ContainerProps extends NodeProps { * * @category Statement */ -export type StatementWithChildren = postcss.Container & { +export type StatementWithChildren = postcss.Container & { nodes: ChildNode[]; } & Statement; @@ -123,7 +123,11 @@ export type NewNode = | undefined; /** PostCSS's built-in normalize function. */ -const postcssNormalize = postcss.Container.prototype.normalize; +const postcssNormalize = postcss.Container.prototype["normalize"] as ( + nodes: postcss.NewChild, + sample: postcss.Node | undefined, + type?: 'prepend' | false +) => postcss.ChildNode[]; /** * A wrapper around {@link postcssNormalize} that converts the results to the diff --git a/pkg/sass-parser/lib/src/statement/root-internal.d.ts b/pkg/sass-parser/lib/src/statement/root-internal.d.ts index 71a9d6b07..ed79eedc9 100644 --- a/pkg/sass-parser/lib/src/statement/root-internal.d.ts +++ b/pkg/sass-parser/lib/src/statement/root-internal.d.ts @@ -34,21 +34,13 @@ export class _Root extends postcss.Root { every( condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean ): boolean; - index(child: ChildNode | number): number; - insertAfter(oldNode: ChildNode | number, newNode: NewNode): this; - insertBefore(oldNode: ChildNode | number, newNode: NewNode): this; + insertAfter(oldNode: postcss.ChildNode | number, newNode: NewNode): this; + insertBefore(oldNode: postcss.ChildNode | number, newNode: NewNode): this; next(): ChildNode | undefined; prepend(...nodes: NewNode[]): this; prev(): ChildNode | undefined; - push(child: ChildNode): this; - removeChild(child: ChildNode | number): this; replaceWith( - ...nodes: ( - | postcss.Node - | ReadonlyArray - | ChildProps - | ReadonlyArray - )[] + ...nodes: NewNode[] ): this; root(): Root; some( diff --git a/pkg/sass-parser/lib/src/statement/rule-internal.d.ts b/pkg/sass-parser/lib/src/statement/rule-internal.d.ts index 93818ea91..262a37240 100644 --- a/pkg/sass-parser/lib/src/statement/rule-internal.d.ts +++ b/pkg/sass-parser/lib/src/statement/rule-internal.d.ts @@ -34,21 +34,13 @@ export class _Rule extends postcss.Rule { every( condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean ): boolean; - index(child: ChildNode | number): number; - insertAfter(oldNode: ChildNode | number, newNode: NewNode): this; - insertBefore(oldNode: ChildNode | number, newNode: NewNode): this; + insertAfter(oldNode: postcss.ChildNode | number, newNode: NewNode): this; + insertBefore(oldNode: postcss.ChildNode | number, newNode: NewNode): this; next(): ChildNode | undefined; prepend(...nodes: NewNode[]): this; prev(): ChildNode | undefined; - push(child: ChildNode): this; - removeChild(child: ChildNode | number): this; replaceWith( - ...nodes: ( - | postcss.Node - | ReadonlyArray - | ChildProps - | ReadonlyArray - )[] + ...nodes: NewNode[] ): this; root(): Root; some(