Skip to content

Commit

Permalink
Add Concern Constructor interface
Browse files Browse the repository at this point in the history
  • Loading branch information
aedart committed Feb 22, 2024
1 parent e9393aa commit 279e3a6
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions packages/contracts/src/support/concerns/ConcernConstructor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import Concern from "./Concern";
import { PROPERTIES } from "./index";

/**
* Concern Constructor
*
* @template T extends Concern
*
* @see Concern
*/
export default interface ConcernConstructor<T extends Concern>
{
/**
* Creates a new concern instance
*
* @param {object} [owner] The owner class instance this concern is injected into.
* Defaults to `this` concern instance if none given.
*
* @throws {Error} When concern is unable to preform initialisation, e.g. caused
* by the owner or other circumstances.
*/
new (owner?: object): T;

/**
* Returns list of property keys that this concern class offers
*
* **Note**: _Only properties and methods returned by this method can be aliased
* into a target class._
*
* @static
*
* @return {PropertyKey[]}
*/
[PROPERTIES](): (keyof T)[];
}

0 comments on commit 279e3a6

Please sign in to comment.