Skip to content
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

Improved types #887

Merged
merged 5 commits into from
Mar 5, 2021
Merged

Improved types #887

merged 5 commits into from
Mar 5, 2021

Conversation

radekmie
Copy link
Contributor

@radekmie radekmie commented Feb 26, 2021

This PR is composed of three parts:

  • b0101cf Switched from bound to unbound methods. It allowed re-enabling of @typescript-eslint/unbound-method.
  • 12e88a1 Improved onChange type. Switch from Value | null into any was needed, to make it possible to use onChange(otherFieldValue, 'otherField'). Additionally, the value argument is not optional anymore. Ideally, it should be something like this:
    type OnChange<Value> = {
      (value: Value): void;
      (value: any, name: string): void;
    };
    However, this breaks a lot of inferred types.
  • 94d48fc Replaced ts-ignore with ts-expect-error. These are strictly better, letting us know that it's no longer needed.

EDIT:

  • 63e4bac I managed to make the onChange typed as planned.
  • 57c0242 I had to revert 94d48fc for Meteor modules as it broke with our internal declarations. It'll require further investigation.

@radekmie radekmie added the Type: Feature New features and feature requests label Feb 26, 2021
@codecov
Copy link

codecov bot commented Feb 26, 2021

Codecov Report

Merging #887 (57c0242) into master (950ba44) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #887   +/-   ##
=======================================
  Coverage   97.49%   97.49%           
=======================================
  Files         176      176           
  Lines        3432     3432           
  Branches      686      686           
=======================================
  Hits         3346     3346           
  Misses          8        8           
  Partials       78       78           
Impacted Files Coverage Δ
packages/uniforms-antd/src/DateField.tsx 100.00% <ø> (ø)
packages/uniforms-antd/src/RadioField.tsx 92.30% <ø> (ø)
packages/uniforms-antd/src/SelectField.tsx 96.00% <ø> (ø)
packages/uniforms-bootstrap3/src/RadioField.tsx 81.25% <ø> (ø)
packages/uniforms-bootstrap3/src/SelectField.tsx 90.00% <ø> (ø)
packages/uniforms-bootstrap4/src/RadioField.tsx 80.00% <ø> (ø)
packages/uniforms-bootstrap4/src/SelectField.tsx 90.00% <ø> (ø)
packages/uniforms-bootstrap4/src/gridClassName.ts 100.00% <ø> (ø)
packages/uniforms-material/src/BoolField.tsx 100.00% <ø> (ø)
packages/uniforms-material/src/RadioField.tsx 89.65% <ø> (ø)
... and 14 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 950ba44...57c0242. Read the comment docs.

packages/uniforms/src/types.ts Show resolved Hide resolved
@radekmie radekmie merged commit a182a92 into master Mar 5, 2021
@radekmie radekmie deleted the better-types branch March 5, 2021 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New features and feature requests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants