-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Bug: [consistent-generic-constructors] improper fix into new Uint8Array<ArrayBufferLike>()
#10445
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
new Uint8Array<ArrayBufferLike>()
This rule is not type-aware and cannot detect that the type What do others say? I don't think the TS lib def is wrong or awkward, so maybe we should add an option to ignore selected constructors? |
Noting that this is a new case with TS 5.7, since, previously, one would have gotten the error I'm wondering if the |
|
Yeah so I guess the rule, without type information, is only really expected to work on non-overloaded class constructors. Which is most anything user-defined, and also probably a majority of the built-in types. My intuition is that an ignore list makes sense, though |
Accepting PRs for specifically the built-in array-likes. |
Uh oh! @RoenLie, the image you shared is missing helpful alt text. Check #10445 (comment). Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image. Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.
|
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=5.7.2&fileType=.ts&code=DYUwLgBAhgXBCqBLAdmAHAQQE5agTwB5tc8AhAVwDNKQsAZRAaxAD4IBeCZEAdwRXTF8ACgCUAbgBQANwD2iACbQpQA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6MgeyeUuX0Ra0A5gMRUytTt3xwy%2BDtFQZIY6AsjgwAXxBagA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkqyARhWANqTokBMADJwMyQAugBpwNSPFgATAK4Zm7Lr06RRNKCTyZk0PADk5qAMIALdNADWZSlpno14vAENMAc3R4FHHv0hiAviD%2BQA&tokens=false
Repro Code
ESLint Config
tsconfig
Expected Result
Either don't report the error, or don't generate invalid code upon fix.
Actual Result
Rule reports error:
If I tap Fix, the code becomes:
And then TypeScript reports error:
Additional Info
If I enable two rules consistent-generic-constructors and no-unnecessary-type-arguments, playground, both rules would report errors.
The outcome depends on the order of fix.
The text was updated successfully, but these errors were encountered: