Decorator Contracts is a library that provides the ability to create and assign Code Contracts to ECMAScript and TypeScript classes. This enables enforcement of the Liskov substitution principle and the Open-closed principle of SOLID to support Design By Contract™.
Performing assertions across a code-base can be redundant and time-consuming. To mitigate this impact on efficiency, a means of disabling assertion checks must be provided. The intent being that during development and debugging the assertions would be executed, but in a production environment the checks would not be performed and instead simply return true.
This should not be a global flag, but a granular one to provide flexibility
There is more public familiarity with GitHub than Azure, plus there is more simplicity currently. Now that Microsoft owns GitHub there is less of a desire to remain in the old location in order to leverage to benefits.
"""
The notions of “stronger” and “weaker” are formally defined from logic: P1 is said to be stronger than P2, and P2 weaker than P1, if P1 implies P2 and they are not equal. As every proposition implies True, and False implies every proposition, it is indeed legitimate to speak of True as the weakest and False as the strongest of all possible assertions.
""" -- Meyer p. 358
The class invariant must not be weaker than the invariant in the superclass. Practically this means that all invariant assertions across classes in the hierarchy are ANDed together.
To guarantee invariants remain valid, public property definitions are forbidden. All interactions with a contracted class must be done through a method or accessor.
Method decorators are registered but not active until this class decorator can associate them with the contractHandler and/or enforce their usage. This requirement simply allows an empty @invariant decorator to be used.
@invariantclassMyClass{
...
}
Tasks
Implementation
Implement overload so that parenthesis is not required