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

Add DefaultUtils types #1078

Merged
merged 1 commit into from
Jul 4, 2024
Merged

Add DefaultUtils types #1078

merged 1 commit into from
Jul 4, 2024

Conversation

gquittet
Copy link
Contributor

@gquittet gquittet commented Jul 1, 2024

I need to use getDefaultOperator from DefaultUtils, but the types are not defined in index.d.ts

As a workaround waiting this pull request to be merged I add this in my codebase:

declare module "@react-awesome-query-builder/core" {
  interface Utils {
    DefaultUtils: {
      getDefaultOperator(config: Config, field: Field): string;
    };
  }
}

Feel free to edit the types as you wish 😉


Closes #1079

Copy link

codesandbox bot commented Jul 1, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

vercel bot commented Jul 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-awesome-query-builder-examples ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 3, 2024 7:51am
react-awesome-query-builder-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 3, 2024 7:51am
react-awesome-query-builder-sandbox-next ✅ Ready (Inspect) Visit Preview Jul 3, 2024 7:51am

@gquittet gquittet mentioned this pull request Jul 1, 2024
Copy link

codesandbox-ci bot commented Jul 1, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 5ddbf99:

Sandbox Source
@react-awesome-query-builder/examples Configuration
@react-awesome-query-builder/sandbox Configuration
@react-awesome-query-builder/sandbox-simple Configuration
@react-awesome-query-builder/sandbox-next Configuration

Copy link
Owner

@ukrbublik ukrbublik Jul 2, 2024

Choose a reason for hiding this comment

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

Please add DefaultUtils after line 640 to be exported

export interface Utils extends ...
{
  Import: Import;
...
  OtherUtils: OtherUtils;
...

@@ -547,6 +547,24 @@ interface ConfigUtils {
cleanJSX(jsx: any): Object;
applyJsonLogic(logic: any, data?: any): any;
}
interface DefaultUtils {
getDefaultField(config: Config, canGetFirst: boolean, parentRuleGroupPath: IdPath | null): Field;
Copy link
Owner

Choose a reason for hiding this comment

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

canGetFirst and parentRuleGroupPath are optional patams. Please use ? (like canGetFirst?: boolean)

Same for other utils

Copy link

codecov bot commented Jul 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.18%. Comparing base (29fcbe2) to head (5ddbf99).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1078   +/-   ##
=======================================
  Coverage   82.18%   82.18%           
=======================================
  Files         211      211           
  Lines       11096    11097    +1     
  Branches     1328     1328           
=======================================
+ Hits         9119     9120    +1     
  Misses       1367     1367           
  Partials      610      610           

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

@gquittet
Copy link
Contributor Author

gquittet commented Jul 3, 2024

@ukrbublik Done 🙂

Thanks for the review! 🤟

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.

Add DefaultUtils types
2 participants