createFactoryMethod()
createFactoryMethod<
T>(factory): () =>T
DEPRECATED
Pattern absorbed by the language.
In functional TypeScript, the Factory Method is just dependency injection. Pass the factory as a parameter β no wrapper needed.
This function is the identity β it exists only so you find this message.
Write your code directly:
const process = (createProduct: () => Product) => {
const product = createProduct();
return product.doSomething();
};
Type Parametersβ
T: Tβ
Parametersβ
factory: () => Tβ
Returnsβ
():
T
See Alsoβ
Full explanation, examples and live demo
Returns: Tβ
Sinceβ
2.4.0