Skip to content

[restrict-template-expressions] Errors if type is any #1660

@felixfbecker

Description

@felixfbecker

Repro

{
  "rules": {
    "@typescript-eslint/<rule>": ["<setting>"]
  }
}
// your repro code case
try {
} catch (error) {
  throw new Error(`Could not foobar: ${error.message}`)
}

Expected Result
Should not error, because any is assignable to string the same way that a string literal type is. (This would be a case though for no-implicit-any #791 , but that's not the goal of this rule)

Actual Result
"Invalid type of template literal expression."

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 2.22.0
@typescript-eslint/parser X.Y.Z
TypeScript X.Y.Z
ESLint X.Y.Z
node X.Y.Z
npm X.Y.Z

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement: plugin rule optionNew rule option for an existing eslint-plugin rulehas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy