From 724fb45f8d97edb5fc7b0af9ef8d13fe74891fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Z=C3=BCnd?= Date: Thu, 13 Aug 2020 11:12:10 +0200 Subject: [PATCH] [ts] Type-check ui/ListModel.js with TypeScript MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R=aerotwist@chromium.org Bug: chromium:1011811 Change-Id: I806598d864d40eab506b1e02483fad8168aba3f2 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2352728 Reviewed-by: Paul Lewis Commit-Queue: Simon Zünd --- front_end/ui/ListModel.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/front_end/ui/ListModel.js b/front_end/ui/ListModel.js index 67a7ab180e..6dfa5a27c7 100644 --- a/front_end/ui/ListModel.js +++ b/front_end/ui/ListModel.js @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @ts-nocheck -// TODO(crbug.com/1011811): Enable TypeScript compiler checks - import * as Common from '../common/common.js'; /** @@ -17,6 +14,7 @@ export class ListModel extends Common.ObjectWrapper.ObjectWrapper { */ constructor(items) { super(); + /** @type {!Array} */ this._items = items || []; } @@ -146,7 +144,7 @@ export class ListModel extends Common.ObjectWrapper.ObjectWrapper { // Splice may fail with too many arguments. const before = this._items.slice(0, from); const after = this._items.slice(to); - this._items = [].concat(before, items, after); + this._items = [...before, ...items, ...after]; } this._replaced(from, removed, items.length); return removed;