Skip to content

Commit 54453c8

Browse files
committed
Move StringifiedIdentifier from handler.ts to helper.ts
1 parent e8e76a7 commit 54453c8

4 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/ts/handler.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { StringifiedIdentifier } from "./helper.js";
2+
13
export class Handler<T> implements Iterable<T> {
24
/** This stores the stringified Identifier as the key and then the values is obviously T. We store the identifier stringified because objects are never equal so we can't `get()` from the Map without using the same obj reference. */
35
protected registered: Map<StringifiedIdentifier, T>;
@@ -163,7 +165,4 @@ export class Identifier {
163165
else
164166
return false;
165167
}
166-
}
167-
168-
/** An alias for a `string` that exists to make typing more clear to the user whenever a stringified identifier is involved, as there are obviously requirements expected in that case that need to be clearly shown to the user to avoid errors. */
169-
export type StringifiedIdentifier = string;
168+
}

src/ts/handlers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//* Ideally I would put things like BackgroundHandler in personalization.ts but because of lexical declarations we can't do that without getting circular imports as far as I can tell. This is fine.
22

33
import { Building, BuildingSave } from "./buildings.js";
4-
import { Handler, Identifier, StringifiedIdentifier, UniqueKeyHandler } from "./handler.js";
5-
import { url } from "./helper.js";
4+
import { Handler, Identifier, UniqueKeyHandler } from "./handler.js";
5+
import { StringifiedIdentifier, url } from "./helper.js";
66
import { Game } from "./main.js";
77
import { Mod } from "./mods.js";
88
import { Background, CurrentlyClickedObject } from "./personalization.js";

src/ts/helper.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,7 @@ export function countVisibleChildren(element: HTMLElement): number {
157157
}
158158
}
159159
return count;
160-
}
160+
}
161+
162+
/** An alias for a `string` that exists to make typing more clear to the user whenever a stringified identifier is involved, as there are obviously requirements expected in that case that need to be clearly shown to the user to avoid errors. */
163+
export type StringifiedIdentifier = string;

src/ts/main.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ If you're not a modder, still read the docs here: https://github.com/clickercook
77
*/
88

99
import { createChangelogEntry, versionChangelogs } from "./changelogs.js";
10-
import { branchQuickSwitch, Interval, object2HTML, url } from "./helper.js";
10+
import { branchQuickSwitch, Interval, object2HTML, StringifiedIdentifier, url } from "./helper.js";
1111
import { expandUpgradesHolder, UpgradeSave } from "./upgrades.js";
1212
import { convert06Save, SaveProvider, Savinator } from "./saving.js";
1313
import { Mod } from "./mods.js"
@@ -17,7 +17,6 @@ import { Handlers, ModHandler } from "./handlers.js";
1717
import { BuildingSave } from "./buildings.js";
1818

1919
import { NewMod } from "./exmod.js"; //* note: this import is intentionally left unused so tsc can find this file and compile it
20-
import { StringifiedIdentifier } from "./handler.js";
2120

2221
// ------------------------------------
2322
// Version Constants

0 commit comments

Comments
 (0)