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