-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Bug: [no-base-to-string] hit URL object but should not #4999
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
Comments
Indeed, this is a bug on the TypeScript side: #1655; microsoft/TypeScript#30225; microsoft/TypeScript#38347. They've been hesitant to fix it there because lib.d.ts changes have a tendency to break other users in surprising ways. Right now the rule hardcodes boolean types to being allowed.
For now the rule does have an {
"rules": {
"no-base-to-string": ["error", {
"ignoredTypeNames": ["Error", "URL"]
}]
}
} Edit: per #5323, |
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=4.7.1-rc&sourceType=module&code=BQOwpg7gBAogTnA9nYByARkg1mEqCU+AdAC6IDKJcAliAObD5A&rules=N4IgAgLgngDgpgZwMYCcCWMIFpEBs0B2EA9AQPZYBGAhgnFhBQhOgQOYgBcIcKKZKEAF8gA&tsConfig=N4XyA
Repro Code
ESLint Config
tsconfig
Expected Result
The code should be fine as the runtime output is:
'Error: broken'
Actual Result
eslint reports:
'new Error('broken') will evaluate to '[object Object]' when stringified.ESLint (@typescript-eslint/no-base-to-string)
Additional Info
No response
Versions
@typescript-eslint/eslint-plugin
5.24.0
@typescript-eslint/parser
5.24.0
TypeScript
4.6.2
ESLint
8.15.0
The text was updated successfully, but these errors were encountered: