[WIP] Improve lazy proxy typing #16
1 changed files with 8 additions and 10 deletions
|
@ -182,6 +182,13 @@ export function createAchievement<T extends AchievementOptions>(
|
||||||
decorator.preConstruct?.(achievement);
|
decorator.preConstruct?.(achievement);
|
||||||
}
|
}
|
||||||
Object.assign(achievement, decoratedData);
|
Object.assign(achievement, decoratedData);
|
||||||
|
for (const decorator of decorators) {
|
||||||
|
decorator.postConstruct?.(achievement);
|
||||||
|
}
|
||||||
|
const decoratedProps = decorators.reduce(
|
||||||
|
(current, next) => Object.assign(current, next.getGatheredProps?.(achievement)),
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
function complete() {
|
function complete() {
|
||||||
earned.value = true;
|
earned.value = true;
|
||||||
|
@ -209,12 +216,7 @@ export function createAchievement<T extends AchievementOptions>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const decoratedProps = decorators.reduce(
|
function gatherProps(this: GenericAchievement): Record<string, unknown> {
|
||||||
(current, next) => Object.assign(current, next.getGatheredProps?.(achievement)),
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
|
|
||||||
function gatherProps(this: Achievement<T>): Record<string, unknown> {
|
|
||||||
const {
|
const {
|
||||||
visibility,
|
visibility,
|
||||||
display,
|
display,
|
||||||
|
@ -242,10 +244,6 @@ export function createAchievement<T extends AchievementOptions>(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const decorator of decorators) {
|
|
||||||
decorator.postConstruct?.(achievement);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (achievement.requirements != null) {
|
if (achievement.requirements != null) {
|
||||||
const requirements = [
|
const requirements = [
|
||||||
createVisibilityRequirement(achievement),
|
createVisibilityRequirement(achievement),
|
||||||
|
|
Loading…
Reference in a new issue