Skip to content

bug(snack-bar,bottom-sheet): Idiomatic configuration not compatible with new ESLint strict type-checked rule #34151

Open

Description

@michael-andre

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

typescript-eslint version 8.0.73 was released on Nov 16, 2026 with a new no-unsafe-class-instance-assignment rule that flags situations where "object literal is used where an instance of class (...) is expected".

Idiomatic configuration of Snackbars or Bottom Sheets (and maybe other components) is achieved (and documented) with the use of a last parameter that falls into that case, because MatSnackBarConfig, MatBottomSheetConfig, etc. are defined as class instead of interface.

As a consequence, a simple project with Material Angular + Typescript-ESLint project with strict type-checked linting enabled reports an error where using the components with the configuration parameter:

snackBar.open(
  'Message archived',
  'Undo',
  { duration: 3000 } // Lint error: This object literal is used where an instance of class `MatSnackBarConfig<any>` is expected.
);

Reproduction

StackBlitz link: https://stackblitz.com/edit/9uwq3dhq?file=eslint.config.mjs,src%2Fmain.ts
Steps to reproduce:

  1. Run npm run lint

Expected Behavior

There is (presumably?) no reason to define the parameters (MatSnackBarConfig, MatBottomSheetConfig...) as classes, interfaces should be used instead.

Actual Behavior

Parameters are defined as classes, so the strict linting rule disallows the use of object literals.

Environment

  • Angular: 22.2
  • CDK/Material: 22.3
  • Browser(s): N/A
  • Operating System (e.g. Windows, macOS, Ubuntu): N/A

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: manyArea label for issues related to many componentsneeds triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions