Skip to content

TS2310: Type 'Selector' recursively references itself as a base type. #232

@ybiquitous

Description

@ybiquitous

Hello, I encounter the following TypeScript error with the version 6.0.3.

Here is the reproduction via Docker:

FROM node:14
WORKDIR /work
RUN git clone --depth=1 https://github.com/postcss/postcss-selector-parser.git /work
RUN npm i typescript@4.0.3
ENTRYPOINT ["npx", "tsc", "postcss-selector-parser.d.ts"]

Put Dockerfile with the content above to any directory and then run the following command:

$ docker build -t postcss-selector-parser:dev .
...

$ docker run --rm -it postcss-selector-parser:dev
postcss-selector-parser.d.ts:335:15 - error TS2310: Type 'Selector' recursively references itself as a base type.

335     interface Selector extends Container<string, Diff<Node, Selector>> {
                  ~~~~~~~~


Found 1 error.

image

The location:

interface Selector extends Container<string, Diff<Node, Selector>> {
type: "selector";
}

See also the real-world reproduction: stylelint/stylelint#4949

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions