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

Enhancement:typeMatchesSpecifier add ability to match via a pattern #6839

Open
Labels
accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or requestpackage: type-utilsIssues related to the @typescript-eslint/type-utils package
@RebeccaStevens

Description

@RebeccaStevens

Before You File a Proposal Please Confirm You Have Done The Following...

Relevant Package

utils

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Description

Add ability to provide a regex expression of the type name instead of a string that has to match exactly.
Additionally, allow for a glob pattern to be given as the "path" for theFileSpecifier.

Fail

// N/A

Pass

// Match all local types prefix with mutabletypeMatchesSpecifier(type,{from:"file",name:/^(M|m)utable.+/u,},program);// Match all local types defined in a test or tests director.typeMatchesSpecifier(type,{from:"file",name:/^.+/u,path:"**/tests?/**"},program);// Match all build in "Readonly" typestypeMatchesSpecifier(type,{from:"lib",name:/^Readonly.+/u,},program);// Match all types in all@foo/* packagestypeMatchesSpecifier(type,{from:"package",name:/^.+/u,package:/^@foo\/.+/u,},program);

Additional Info

New specifier definitions will look something like this:

interfaceFileSpecifier{from:'file';name:string|RegExp|(string|RegExp)[];path?:string;}interfaceLibSpecifier{from:'lib';name:string|RegExp|(string|RegExp)[];}interfacePackageSpecifier{from:'package';name:string|RegExp|(string|RegExp)[];package:string|RegExp;}

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or requestpackage: type-utilsIssues related to the @typescript-eslint/type-utils package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp