Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bug: [consistent-generic-constructors] improper fix intonew Uint8Array<ArrayBufferLike>() #10445

Labels
accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@yoursunny

Description

@yoursunny

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I havesearched for related issues and found none that matched my issue.
  • I haveread the FAQ and my problem is not listed.

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

leta:Uint8Array<ArrayBufferLike>=newUint8Array();voida;

ESLint Config

{"rules":{"@typescript-eslint/consistent-generic-constructors":"error"}}

tsconfig

{"compilerOptions": {"lib": ["es2023"],"module":"es2022","strictNullChecks":true,"target":"es2023"  }}

Expected Result

Either don't report the error, or don't generate invalid code upon fix.

Actual Result

Rule reports error:

The generic type arguments should be specified as part of the constructor type arguments. 1:5 - 1:54

If I tapFix, the code becomes:

leta=newUint8Array<ArrayBufferLike>();voida;

And then TypeScript reports error:

2554: Expected 1-3 arguments, but got 0. 1:9 - 1:42

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.

  • If consistent-generic-constructors is fixed first, the above problem occurs.
  • If no-unnecessary-type-arguments is fixed first, the resulting code is well-formed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp