From c2986891f6aac87cec98232735945af756e6643f Mon Sep 17 00:00:00 2001 From: Yusuke Sakurai Date: Fri, 7 Feb 2020 16:23:38 +0900 Subject: remove non-null assertion operator from std (part1) (#3900) --- std/testing/format.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'std/testing/format.ts') diff --git a/std/testing/format.ts b/std/testing/format.ts index 953347c27..62fdde5eb 100644 --- a/std/testing/format.ts +++ b/std/testing/format.ts @@ -1,3 +1,5 @@ +import { assert } from "./asserts.ts"; + // This file is ported from pretty-format@24.0.0 /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. @@ -361,7 +363,9 @@ const getKeysOfEnumerableProperties = (object: {}): Array => { if (Object.getOwnPropertySymbols) { Object.getOwnPropertySymbols(object).forEach((symbol): void => { - if (Object.getOwnPropertyDescriptor(object, symbol)!.enumerable) { + const d = Object.getOwnPropertyDescriptor(object, symbol); + assert(d != null); + if (d.enumerable) { keys.push(symbol); } }); -- cgit v1.2.3