From f4285b808702d08a3f8996c1fddcf3ca208b41e2 Mon Sep 17 00:00:00 2001 From: Maarten Staa Date: Thu, 20 Sep 2018 15:55:29 +0200 Subject: [PATCH] Sortablejs: Enable strict null checks. --- types/sortablejs/sortablejs-tests.ts | 10 +++++----- types/sortablejs/tsconfig.json | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/types/sortablejs/sortablejs-tests.ts b/types/sortablejs/sortablejs-tests.ts index b3b8629ff1..826fbd9b52 100644 --- a/types/sortablejs/sortablejs-tests.ts +++ b/types/sortablejs/sortablejs-tests.ts @@ -2,9 +2,9 @@ import Sortable = require("sortablejs"); -var simpleList = document.getElementById('list'); +var simpleList = document.createElement('ul'); var list = simpleList; -var el = document.getElementById('el'); +var el = document.createElement('div'); var sortable = new Sortable(simpleList, {}); var order = sortable.toArray(); var angular: any; @@ -86,7 +86,7 @@ simpleList.innerHTML = Array.apply(null, new Array(100)).map(function(value: any (function() { 'use strict'; - var byId = function(id: string) { return document.getElementById(id); }, + var byId = function(id: string) { return document.getElementById(id)!; }, loadScripts = function(desc: any, callback: any) { var deps: string[] = []; @@ -172,7 +172,7 @@ simpleList.innerHTML = Array.apply(null, new Array(100)).map(function(value: any animation: 150, filter: '.js-remove', onFilter: function(evt) { - evt.item.parentNode.removeChild(evt.item); + evt.item.parentNode!.removeChild(evt.item); } }); @@ -279,7 +279,7 @@ simpleList.innerHTML = Array.apply(null, new Array(100)).map(function(value: any document.addEventListener("DOMContentLoaded", function() { function setNoiseBackground(el: any, width: number, height: number, opacity: number) { var canvas = document.createElement("canvas"); - var context = canvas.getContext("2d"); + var context = canvas.getContext("2d")!; canvas.width = width; canvas.height = height; diff --git a/types/sortablejs/tsconfig.json b/types/sortablejs/tsconfig.json index a5e89ba671..753fea5190 100644 --- a/types/sortablejs/tsconfig.json +++ b/types/sortablejs/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -21,4 +21,4 @@ "index.d.ts", "sortablejs-tests.ts" ] -} \ No newline at end of file +}