assert
This is an internal function documented here for reference by people doing development on this library.
Asserts that a value is true. You should only use one condition at a time. If you are working with a value that should always be true, this is easier than putting if(condition) around what you are going to use the condition for.
Example
instead of this:
let variableWeExpectWilNotBeNullOrUndefined: SomeType;
// somewhere in here we set the variable
if(variableWeExpectWilNotBeNullOrUndefined) {
return; // or throw an exception or whatever
}
// now use the variable without having to use ? or ! everywheredo this:
let variableWeExpectWilNotBeNullOrUndefined: SomeType;
// somewhere in here we set the variable
assert (variableWeExpectWilNotBeNullOrUndefined, 'variableWeExpectWilNotBeNullOrUndefined');
// now use the variable without having to use ? or ! everywherePresentation
function assert (condition: boolean, context: string): void;Returns
voidParameters
| Name | Type | Description |
|---|---|---|
| condition | boolean | condition to check |
| context | string | description of what we checked. If you put a GUID in the string it will make it easier to find the error in the source code. |