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

Export interfaces for function signatures #1161

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tmisirpash
Copy link

@tmisirpash tmisirpash commented Feb 4, 2025

Export interfaces for the following:

  • Integer
  • Long
  • Float
  • Double
  • Date (represented as string)
  • Timestamp (represented as string)
  • TwoDimensionalAggregation
  • ThreeDimensionalAggregation

Would a new package @osdk/functions be a better place to export these types?

} | {
startValue: T;
endValue?: T;
};
Copy link
Author

Choose a reason for hiding this comment

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

Previously startValue and endValue were both typed as being required, but this isn't strictly the case -- either the start value or the end value can be omitted from the range.

endValue?: T;
};

export type AllowedBucketTypes = string | number | boolean;
Copy link
Author

Choose a reason for hiding this comment

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

General question: when a query returns an aggregation through a client(myQuery).executeFunction call, at what point do these get narrowed based on the exact types in the query definition? From the looks of it I still need to switch on the string case, the number case and the boolean case to properly handle the output.

Copy link
Member

Choose a reason for hiding this comment

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

export type Integer<T extends number = number> = T;
export type Float<T extends number = number> = T;
export type Double<T extends number = number> = T;
export type Long<T extends string = string> = T;
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should brand these? (Truly a question, Im wondering without a brand do the aliases get erased making the static analysis harder?)

Copy link
Author

Choose a reason for hiding this comment

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

For analysis purpose branding these strings would definitely be nice to prevent the compiler from interning the types.

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