Skip to content

Commit

Permalink
refactor: Consistent typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Josmithr committed Dec 3, 2024
1 parent 56b5e82 commit bd9991e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/dds/tree/src/simple-tree/arrayNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ export function arraySchema<
public static get childTypes(): ReadonlySet<TreeNodeSchema> {
return lazyChildTypes.value;
}
public static readonly metadata: TMetadata | undefined = metadata;
public static readonly metadata?: TMetadata = metadata;

// eslint-disable-next-line import/no-deprecated
public get [typeNameSymbol](): TName {
Expand Down
2 changes: 1 addition & 1 deletion packages/dds/tree/src/simple-tree/leafNodeSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class LeafNodeSchema<Name extends string, const T extends ValueSchema>
public readonly info: T;
public readonly implicitlyConstructable = true as const;
public readonly childTypes: ReadonlySet<TreeNodeSchema> = new Set();
public readonly metadata: NodeSchemaMetadata | undefined = undefined; // TODO
public readonly metadata?: NodeSchemaMetadata | undefined = undefined;

public create(data: TreeValue<T> | FlexTreeNode): TreeValue<T> {
if (isFlexTreeNode(data)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/dds/tree/src/simple-tree/mapNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export function mapSchema<
public static get childTypes(): ReadonlySet<TreeNodeSchema> {
return lazyChildTypes.value;
}
public static readonly metadata = metadata;
public static readonly metadata?: TMetadata = metadata;

// eslint-disable-next-line import/no-deprecated
public get [typeNameSymbol](): TName {
Expand Down
2 changes: 1 addition & 1 deletion packages/dds/tree/src/simple-tree/objectNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ export function objectSchema<
public static get childTypes(): ReadonlySet<TreeNodeSchema> {
return lazyChildTypes.value;
}
public static readonly metadata = metadata;
public static readonly metadata?: TMetadata = metadata;

// eslint-disable-next-line import/no-deprecated
public get [typeNameSymbol](): TName {
Expand Down
6 changes: 3 additions & 3 deletions packages/dds/tree/src/test/simple-tree/core/types.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe("simple-tree types", () => {
public static readonly identifier = "Subclass";
public static readonly info = numberSchema;
public static readonly implicitlyConstructable: false;
public static readonly metadata: NodeSchemaMetadata | undefined = undefined;
public static readonly metadata?: NodeSchemaMetadata = undefined;

public static override prepareInstance<T2>(
this: typeof TreeNodeValid<T2>,
Expand Down Expand Up @@ -237,7 +237,7 @@ describe("simple-tree types", () => {
public static readonly info = numberSchema;
public static readonly implicitlyConstructable: false;
public static readonly childTypes: ReadonlySet<TreeNodeSchema> = new Set();
public static readonly metadata: NodeSchemaMetadata | undefined = undefined;
public static readonly metadata?: NodeSchemaMetadata = undefined;

public static override buildRawNode<T2>(
this: typeof TreeNodeValid<T2>,
Expand Down Expand Up @@ -291,7 +291,7 @@ describe("simple-tree types", () => {
public static readonly info = numberSchema;
public static readonly implicitlyConstructable: false;
public static readonly childTypes: ReadonlySet<TreeNodeSchema> = new Set();
public static readonly metadata: NodeSchemaMetadata | undefined = undefined;
public static readonly metadata?: NodeSchemaMetadata = undefined;

public static override buildRawNode<T2>(
this: typeof TreeNodeValid<T2>,
Expand Down

0 comments on commit bd9991e

Please sign in to comment.