Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(AliasStore): support symbols #348

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/lib/structures/AliasStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ export class AliasStore<T extends AliasPiece, StoreName extends keyof StoreRegis
/**
* The aliases referencing to pieces.
*/
public readonly aliases = new Collection<string, T>();
public readonly aliases = new Collection<string | symbol, T>();

/**
* Looks up the name by the store, falling back to an alias lookup.
* @param key The key to look for.
*/
public override get(key: string): T | undefined {
public override get(key: string | symbol): T | undefined {
return super.get(key) ?? this.aliases.get(key);
}

/**
* Checks whether a key is in the store, or is an alias
* @param key The key to check
*/
public override has(key: string): boolean {
public override has(key: string | symbol): boolean {
return super.has(key) || this.aliases.has(key);
}

Expand All @@ -33,7 +33,7 @@ export class AliasStore<T extends AliasPiece, StoreName extends keyof StoreRegis
* @param name The name of the file to load.
* @return Returns the piece that was unloaded.
*/
public override unload(name: string | T): Promise<T> {
public override unload(name: string | symbol | T): Promise<T> {
const piece = this.resolve(name);

// Unload all aliases for the given piece:
Expand Down