Problem
DeployAccountMethod.with(...) is supposed to allow fluent method chaining (e.g., setting a custom description), but it returns the base DeployMethod type instead of DeployAccountMethod. This breaks OOP expectations: any subclass that overrides with() has its type erased, forcing callers to either downcast or duplicate logic.
Expected behavior
DeployAccountMethod.with(...) should return DeployAccountMethod (or use a generic/self-referential return type pattern like this) so callers can continue chaining DeployAccountMethod-specific methods without losing type information.
Why this matters
This is a basic OOP contract violation. When a subclass's method returns the parent type, it destroys polymorphism and forces consumers to work around it (e.g., by reimplementing the subclass entirely just to fix the return type). Fluent APIs depend on each builder method returning the correct this type.
A common fix in TypeScript is to use a generic self-referential pattern or ensure overridden methods narrow the return type appropriately.
Problem
DeployAccountMethod.with(...)is supposed to allow fluent method chaining (e.g., setting a custom description), but it returns the baseDeployMethodtype instead ofDeployAccountMethod. This breaks OOP expectations: any subclass that overrideswith()has its type erased, forcing callers to either downcast or duplicate logic.Expected behavior
DeployAccountMethod.with(...)should returnDeployAccountMethod(or use a generic/self-referential return type pattern likethis) so callers can continue chainingDeployAccountMethod-specific methods without losing type information.Why this matters
This is a basic OOP contract violation. When a subclass's method returns the parent type, it destroys polymorphism and forces consumers to work around it (e.g., by reimplementing the subclass entirely just to fix the return type). Fluent APIs depend on each builder method returning the correct
thistype.A common fix in TypeScript is to use a generic self-referential pattern or ensure overridden methods narrow the return type appropriately.