diff --git a/src/lib/structures/AliasPiece.ts b/src/lib/structures/AliasPiece.ts index 245852be..97eb5862 100644 --- a/src/lib/structures/AliasPiece.ts +++ b/src/lib/structures/AliasPiece.ts @@ -21,7 +21,7 @@ export class AliasPiece, options: AliasPieceOptions = {}) { super(context, options); this.aliases = options.aliases ?? []; } @@ -48,7 +48,9 @@ export interface AliasPieceJSON extends Piece.JSON { export namespace AliasPiece { export const { Location } = Piece; export type Options = AliasPieceOptions; - export type Context = Piece.Context; + /** @deprecated Use {@linkcode LoaderContext} instead. */ + export type Context = Piece.LoaderContext; + export type LoaderContext = Piece.LoaderContext; export type JSON = AliasPieceJSON; export type LocationJSON = Piece.LocationJSON; } diff --git a/src/lib/structures/Piece.ts b/src/lib/structures/Piece.ts index 75a5c8a2..587df673 100644 --- a/src/lib/structures/Piece.ts +++ b/src/lib/structures/Piece.ts @@ -8,14 +8,14 @@ import type { StoreOf, StoreRegistryKey } from './StoreRegistry'; * The context for the piece, contains extra information from the store, * the piece's path, and the store that loaded it. */ -export interface PieceContext { +export interface LoaderPieceContext { /** * The root directory the piece was loaded from. */ readonly root: string; /** - * The path the module was loaded from, relative to {@link PieceContext.root}. + * The path the module was loaded from, relative to {@link LoaderPieceContext.root}. */ readonly path: string; @@ -30,6 +30,9 @@ export interface PieceContext; } +/** @deprecated Use {@linkcode LoaderPieceContext} instead. */ +export interface PieceContext extends LoaderPieceContext {} + /** * The options for the {@link Piece}. */ @@ -76,7 +79,7 @@ export class Piece, options: PieceOptions = {}) { + public constructor(context: Piece.LoaderContext, options: PieceOptions = {}) { this.store = context.store; this.location = new PieceLocation(context.path, context.root); this.name = options.name ?? context.name; @@ -149,7 +152,9 @@ export interface PieceJSON { export namespace Piece { export const Location = PieceLocation; export type Options = PieceOptions; - export type Context = PieceContext; + /** @deprecated Use {@linkcode LoaderContext} instead. */ + export type Context = LoaderPieceContext; + export type LoaderContext = LoaderPieceContext; export type JSON = PieceJSON; export type LocationJSON = PieceLocationJSON; }