8000 fix: type error in validate when using min max by chen201724 · Pull Request #413 · cyjake/leoric · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: type error in validate when using min max #413

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

Merged
merged 4 commits into from
Dec 5, 2023

Conversation

chen201724
Copy link
Contributor
@chen201724 chen201724 commented Dec 4, 2023

Background

When using the built-in validators min and max like this

@Column({
  type: DataTypes.TINYINT,
  validate: {
    min: 0,
    max: 10,
  },
})
count: number;

It will trigger a TypeScript type error: Type 'number' is not assignable to type 'Validator'.

Summary

Complete the type BaseValidateArgs

Copy link
Collaborator
@JimmyDaddy JimmyDaddy left a comment

Choose a reason for hiding this comment

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

test/types/decorators.test.ts 里面加个单测吧

@chen201724
Copy link
Contributor Author

test/types/decorators.test.ts 里面加个单测吧

加了一个 max min 的单测

Copy link
codecov bot commented Dec 5, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1e8a267) 96.66% compared to head (6d25cce) 96.66%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #413   +/-   ##
=======================================
  Coverage   96.66%   96.66%           
=======================================
  Files          45       45           
  Lines        3627     3627           
  Branches       72       72           
=======================================
  Hits         3506     3506           
  Misses        106      106           
  Partials       15       15           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JimmyDaddy JimmyDaddy merged commit 55539b6 into cyjake:master Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0