-
Notifications
You must be signed in to change notification settings - Fork 550
[DRAFT] feat(tree): Add Record node kind #24908
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
base: main
Are you sure you want to change the base?
Conversation
true, | ||
) as TreeNodeSchema, | ||
return this.getStructuralType(fullName, types, () => | ||
this.namedMap(fullName, nameOrAllowedTypes as T, false, true), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for reviewers: Removed unneeded cast
* | ||
* @privateRemarks | ||
* The name produced at the type level here is not as specific as it could be, however doing type-level sorting and escaping is a real mess. | ||
* There are cases where not having this full type provided will be less than ideal since TypeScript's structural types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: fix this
@@ -438,19 +438,23 @@ export enum NodeKind { | |||
/** | |||
* A node which serves as a map, storing children under string keys. | |||
*/ | |||
Map, | |||
Map = 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for reviewers: just made the existing values here explicit. In the event that more changes are needed here, this makes it a bit more clear that the values should be preserved.
@@ -807,6 +836,9 @@ export class SchemaFactoryAlpha<out TScope extends string | undefined = string | | |||
}; | |||
static readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha_2<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2<FieldKind_2.Optional, T, TCustomMetadata>; | |||
readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha_2<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2<FieldKind_2.Optional, T, TCustomMetadata>; | |||
record<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchemaNonClass<ScopedSchemaName<TScope, `Record<${string}>`>, NodeKind.Record, TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, `Record<${string}>`>, NodeKind.Record>, RecordNodeInsertableData<T>, true, T, undefined>; | |||
record<const Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Record, TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>, RecordNodeInsertableData<T>, true, T, undefined>; | |||
recordAlpha<const Name extends TName, const T extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>): RecordNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for reviewers: Separate "Alpha" version to parallel the other "Alpha" versions of the APIs that accept additional parameters. The non-"Alpha" versions will likely be promoted to beta sooner than this one.
packages/dds/tree/src/simple-tree/node-kinds/record/recordNode.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/simple-tree/node-kinds/record/recordNode.ts
Outdated
Show resolved
Hide resolved
packages/dds/tree/src/simple-tree/node-kinds/record/recordNode.ts
Outdated
Show resolved
Hide resolved
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output
|
This is a draft proof of concept. The actual changes will likely be split out into separate, smaller PRs.