Skip to content

Commit

Permalink
Fix bug in ToSettingAssignmentType with the apparent type of Instance…
Browse files Browse the repository at this point in the history
…Type<T>
  • Loading branch information
LukeAbby committed Dec 22, 2024
1 parent bd10277 commit a837473
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/foundry/client/core/settings.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ declare global {
type ToSettingAssignmentType<T extends Type> = ReplaceUndefinedWithNull<
| SettingType<T>
// TODO(LukeAbby): The `fromSource` function is called with `strict` which changes how fallback behaviour works. See `ClientSettings#set`
| (T extends DataModel.AnyConstructor ? DataModel.ConstructorDataFor<InstanceType<T>> : never)
// Note(LukeAbby): This doesn't use `InstanceType` because of this TypeScript issue: https://github.com/microsoft/TypeScript/issues/60839
| (T extends (abstract new (arg0: never, ...args: never[]) => infer Instance extends DataModel.Any)
? DataModel.ConstructorDataFor<Instance>
: never)
>;

type SettingInitializedType<N extends Namespace, K extends Key> = ToSettingInitializedType<ConfiguredType<N, K>>;
Expand Down

0 comments on commit a837473

Please sign in to comment.