Skip to content

chore: fix FakerModule test type#3866

Open
ST-DDT wants to merge 2 commits into
nextfrom
fix/test/FakerModule-type
Open

chore: fix FakerModule test type#3866
ST-DDT wants to merge 2 commits into
nextfrom
fix/test/FakerModule-type

Conversation

@ST-DDT
Copy link
Copy Markdown
Member

@ST-DDT ST-DDT commented May 29, 2026

Update FakerModule test type to latest version.

@ST-DDT ST-DDT added this to the v10.x milestone May 29, 2026
@ST-DDT ST-DDT requested review from a team May 29, 2026 21:42
@ST-DDT ST-DDT self-assigned this May 29, 2026
@ST-DDT ST-DDT added c: chore PR that doesn't affect the runtime behavior p: 1-normal Nothing urgent labels May 29, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented May 29, 2026

Deploy Preview for fakerjs ready!

Name Link
🔨 Latest commit 623293a
🔍 Latest deploy log https://app.netlify.com/projects/fakerjs/deploys/6a1a9da40c29980008813b6f
😎 Deploy Preview https://deploy-preview-3866.fakerjs.dev
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@ST-DDT ST-DDT changed the title chore: fix FakerModule type chore: fix FakerModule test type May 29, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.86%. Comparing base (5bd8709) to head (623293a).

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #3866      +/-   ##
==========================================
- Coverage   98.92%   98.86%   -0.07%     
==========================================
  Files         908      908              
  Lines        3159     3159              
  Branches      581      581              
==========================================
- Hits         3125     3123       -2     
- Misses         30       32       +2     
  Partials        4        4              

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

[Key in keyof Faker]: Faker[Key] extends Callable | string | number | number[]
? never
: Key extends 'definitions' | 'locales'
: Key extends 'definitions' | 'rawDefinitions' | 'fakerCore'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (if-minor): have you considered something like this?

/**
 * Identity type whose constraint forces every member to be a real key of `Faker`.
 * This makes a stale entry in the {@link FakerModule} exclusion list fail to compile.
 */
type FakerKeys<T extends keyof Faker> = T;

/**
 * A type allowing only the names of faker modules.
 */
type FakerModule = {
  [Key in keyof Faker]: Faker[Key] extends Callable | string | number | number[]
    ? never
    : Key extends FakerKeys<'definitions' | 'rawDefinitions' | 'fakerCore'>
      ? never
      : Key;
}[keyof Faker];

Copy link
Copy Markdown
Member Author

@ST-DDT ST-DDT May 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the benefit of that?
Do detect invalidly banned/non-existing keys?
Since it does not detect invalidly allowed keys, I'm kind of neutral about this.

@others any preference?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

detect invalidly banned/non-existing keys

exactly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: chore PR that doesn't affect the runtime behavior p: 1-normal Nothing urgent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants