Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript eslint warning @typescript-eslint/no-unsafe-argument when using switchMapTo #6665

Closed
prabh-62 opened this issue Nov 5, 2021 · 1 comment

Comments

@prabh-62
Copy link

prabh-62 commented Nov 5, 2021

Bug Report

Current Behavior
Using switchMapTo with @typescript-eslint gives no-unsafe-argument warning.

Unsafe argument of type OperatorFunction<any, number> assigned to a parameter of type OperatorFunction<number, number>.eslint@typescript-eslint/no-unsafe-argument

Expected behavior
Using switchMapTo should not produce any @typescript-eslint warnings.

Reproduction

  • npx @angular/cli@13 new web-apps --create-application false
  • cd web-apps
  • yarn ng g app admin-console --prefix ac --style css --routing
  • yarn ng add @angular-eslint/schematics@next
  • Add .eslintrc.json file at root manually
{
  "root": true,
  "ignorePatterns": ["projects/**/*"],
  "plugins": [],
  "overrides": [
    {
      "files": ["*.ts"],
      "parserOptions": {
        "project": ["tsconfig.json"],
        "createDefaultProgram": true
      },
      "extends": [
        "eslint:recommended",
        "plugin:@typescript-eslint/recommended",
        "plugin:@typescript-eslint/recommended-requiring-type-checking",
        "plugin:@angular-eslint/all"
      ],
      "rules": {
        "@angular-eslint/sort-ngmodule-metadata-arrays": "off",
        "@typescript-eslint/no-unused-vars": "off",
        "@angular-eslint/use-injectable-provided-in": "off"
      }
    },
    {
      "files": ["*.html"],
      "extends": ["plugin:@angular-eslint/template/all"],
      "rules": {
        "@angular-eslint/template/i18n": "off"
      }
    }
  ]
}
  • Edit projects/admin-console/src/app/app.component.ts and add
public complexFn() {
    console.log(lastValueFrom(interval(1000).pipe(switchMapTo(of(1)))));
  }
  • yarn ng lint --project admin-console

  • REPL or Repo link:
    NA

console.log(lastValueFrom(interval(1000).pipe(switchMapTo(of(1)))));

Environment

  • Runtime: [e.g. Node v16, Chrome v95]
  • RxJS version: 7.4.0
  • (If bug is related) Loader, build configuration: [e.g webpack, angular-cli version, config] Angular CLI 13

Possible Solution

Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.
eslint_no_unsafe_switchmapTo

@cartant
Copy link
Collaborator

cartant commented Nov 5, 2021

See #6536

@cartant cartant closed this as completed Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants