@types/oojs
Advanced tools
Comparing version 6.0.0 to 6.0.1
@@ -5,25 +5,17 @@ declare namespace OO { | ||
/** | ||
* Register a class with the factory. | ||
* Register a constructor with the factory. | ||
* | ||
* function MyClass() {}; | ||
* OO.initClass( MyClass ); | ||
* MyClass.key = 'hello'; | ||
* | ||
* // Register class with the factory | ||
* MyClass.static.name = 'hello'; | ||
* // Register class with the factory, available via the symbolic name "hello" | ||
* factory.register( MyClass ); | ||
* | ||
* // Instantiate a class based on its registered key (also known as a "symbolic name") | ||
* factory.create( 'hello' ); | ||
* | ||
* @param constructor Class to use when creating an object | ||
* @param key The key for {@link create}. | ||
* This parameter is usually omitted in favour of letting the class declare | ||
* its own key, through `MyClass.key`. | ||
* For backwards-compatibility with OOjs 6.0 (2021) and older, it can also be declared | ||
* via `MyClass.static.name`. | ||
* @param constructor Constructor to use when creating object | ||
* @param name Symbolic name to use for {@link create()}. | ||
* This parameter may be omitted in favour of letting the constructor decide | ||
* its own name, through `constructor.static.name`. | ||
* @throws {Error} If a parameter is invalid | ||
*/ | ||
register( | ||
constructor: (ConstructorLike & { key: string }) | (ConstructorLike & { static: { name: string } }), | ||
): void; | ||
register(constructor: ConstructorLike & { static: { name: string } }): void; | ||
@@ -76,3 +68,3 @@ /** | ||
interface FactoryConstructor { | ||
new (): Factory; | ||
new(): Factory; | ||
prototype: Factory; | ||
@@ -79,0 +71,0 @@ super: RegistryConstructor; |
{ | ||
"name": "@types/oojs", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "TypeScript definitions for OOjs", | ||
@@ -23,4 +23,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/oojs", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "ec171104bfdd23a693f58761b6f8780a40217102ad906087c372f6395b688089", | ||
"typesPublisherContentHash": "4bb60823876d124163ec320f1b83263018cb7ba8aab9e48929e2faed570ee2b0", | ||
"typeScriptVersion": "4.2" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Sun, 13 Nov 2022 01:32:45 GMT | ||
* Last updated: Wed, 23 Nov 2022 18:11:54 GMT | ||
* Dependencies: none | ||
@@ -14,0 +14,0 @@ * Global values: `OO` |
32361
736