added strictNullChecks, removed addtl tslint rules, added null checks

This commit is contained in:
Allen Gammel
2018-08-22 08:40:04 -05:00
parent 625ba41861
commit 236fe406c7
3 changed files with 11 additions and 11 deletions
@@ -1,7 +1,8 @@
// import { LocalStorage } from 'node-localstorage';
// import { LocalStorage } from 'node-localstorage'; // Removed since this pkg isn't getting installed.
import ExpiredStorage = require('expired-storage');
// const localStorage = new LocalStorage('./scratch', Infinity);
// const expiredStorage = new ExpiredStorage(localStorage); // ExpiredStorage requires a LocalStorage provider
const expiredStorage = new ExpiredStorage();
const mjkModel = {
@@ -26,7 +27,9 @@ if (typeof mjkTest === 'undefined' || mjkTest.firstName !== mjkModel.firstName |
throw new Error('.setJson method is not working!');
}
if (expiredStorage.keys(true).length === 2) {
const keyCheck = expiredStorage.keys(true);
if (keyCheck && keyCheck.length === 2) {
throw new Error('.keys method has failed.');
}
@@ -44,7 +47,7 @@ do {
const expiredKeys = expiredStorage.clearExpired();
if (expiredKeys.indexOf('apc') === -1) {
if (expiredKeys.indexOf('apc') !== -1) {
throw new Error('.clearExpired did not work..');
}
@@ -56,7 +59,9 @@ expiredStorage.setItem('puscifer', 'the humbling river', 10000);
expiredStorage.updateExpiration('puscifer', 5000);
if (expiredStorage.getTimeLeft('puscifer') >= 10000) {
const checkKeyTime = expiredStorage.getTimeLeft('puscifer');
if (checkKeyTime && checkKeyTime >= 10000) {
throw new Error('.updateExpiration method is broken -- or .getTimeLeft method is broken.');
}
+1 -1
View File
@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
+1 -6
View File
@@ -1,8 +1,3 @@
{
"extends": "dtslint/dt.json",
"rules": {
"no-void-expression": false,
"no-duplicate-imports": false,
"no-unnecessary-generics": false
}
"extends": "dtslint/dt.json"
}