Skip to content

Conversation

@KuberSethi
Copy link
Contributor

@KuberSethi KuberSethi commented Oct 23, 2025

Adds the core types that will power shapes.

Shapes are intended to be the tool for when users want frontend-only types that are derived from ontology types but with nullability checks, certain fields applied, and OSDK operations performed on top of them. By providing a first-class way to handle this, users will no longer need to maintain many permutations of the same types.

Future PRs will use these types to implement shape behavior and functionality.

Tried to keep changes mostly constrained to the shapes package - would love more review attention to the seams where this interacts with the rest of the codebase.

T extends boolean = false,
ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<L> = {}
> = PageResult<MaybeScore<Osdk.Instance<Q, ExtractOptions<R, S, T>, PropertyKeys<Q> extends L ? never : L>, ORDER_BY_OPTIONS>>;
> = PageResult<MaybeScore<Osdk.Instance<Q, ExtractOptions<R, S, T>, PropertyKeys<Q> extends L ? PropertyKeys<Q> : L>, ORDER_BY_OPTIONS>>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Required to facilitate property selection for shapes

* // player.name is string (not string | undefined)
* ```
*/
export interface ShapeObjectSet<
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This approach results in some duplication but I couldn't think of a better way to do this that didn't result in infinite type explosion or edits to ObjectSet typing


for (
const list of [
shape.__requiredOrThrowProps,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it makes sense to support both of these but happy to just have one for now if we want to make things simpler

readonly __prefetchInterfaces?: readonly InterfaceDefinition[];
}

export interface ShapeDefinitionBuilder<
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Likewise here we end up with some duplication but I think its fine here (less ideal in ShapeObjectSet)

// If there aren't any additional properties, then we want GetPropsKeys to default to PropertyKeys<Q>
GetPropsKeys<Q, P, [R] extends [{}] ? false : true>
>
& (Q extends { __shapeMarker: { requiredProps: infer REQUIRED } }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to hook into Osdk.Instance at some point and this is the way that made sense to me. Open to other ideas though.

@KuberSethi KuberSethi marked this pull request as ready for review October 29, 2025 00:41
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