Skip to content

Commit

Permalink
refactor!: make Any types more restrictive
Browse files Browse the repository at this point in the history
  • Loading branch information
kmoschcau committed May 20, 2024
1 parent 9d7a597 commit 6a3bcf9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/foundry/common/abstract/data.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ export declare namespace DataModel {
}

/** Any DataModel. */
type Any = DataModel<any, any>;
type Any = DataModel<SchemaField.Any, any>;

/**
* A helper type to extract the {@link DataSchema} from a {@link DataModel}.
Expand Down
4 changes: 2 additions & 2 deletions src/foundry/common/abstract/document.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -789,10 +789,10 @@ declare abstract class Document<

declare namespace Document {
/** Any Document */
type Any = Document<fields.SchemaField.AnyWithFlags, any, any>;
type Any = Document<fields.SchemaField.AnyWithFlags, AnyMetadata, any>;

/** Any Document, that is a child of the given parent Document. */
type AnyChild<Parent extends Any | null> = Document<any, any, Parent>;
type AnyChild<Parent extends Any | null> = Document<fields.SchemaField.AnyWithFlags, AnyMetadata, Parent>;

type Constructor = Pick<typeof Document, keyof typeof Document> & (new (...args: any[]) => Document.Any);

Expand Down
4 changes: 2 additions & 2 deletions src/foundry/common/data/fields.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ declare namespace DataField {
type MergedOptions<Options extends DataFieldOptions.Any> = SimpleMerge<DefaultOptions, Options>;

/** Any DataField. */
type Any = DataField<any, any, any, any>;
type Any = DataField<DataFieldOptions.Any, any, any, any>;

/** A DataField with unknown inner types. */
type Unknown = DataField<any, unknown, unknown, unknown>;
Expand Down Expand Up @@ -1465,7 +1465,7 @@ declare class SetField<

declare namespace SetField {
/** Any SetField */
type Any = SetField<any, any, any, any, any, any, any, any>;
type Any = SetField<DataField.Any, any, any, any, any, any, any, any>;

/**
* A shorthand for the options of a SetField class.
Expand Down

0 comments on commit 6a3bcf9

Please sign in to comment.