From 45859b952fd5c3d94f9f0b947c4671b7a945fe39 Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Mon, 19 Sep 2022 12:51:50 -0700 Subject: [PATCH] testing: fix error when updating test items without URIs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TS allowed me to assign `(u: URI) => string` to `(u: URI | undefined) => string` which it seems like should not be valid 🤔 Fixes #160318 --- src/vs/workbench/api/common/extHostTestItem.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/api/common/extHostTestItem.ts b/src/vs/workbench/api/common/extHostTestItem.ts index 07b4601f8ebc5..d406c5bc87062 100644 --- a/src/vs/workbench/api/common/extHostTestItem.ts +++ b/src/vs/workbench/api/common/extHostTestItem.ts @@ -167,7 +167,7 @@ export class ExtHostTestItemCollection extends TestItemCollection constructor(controllerId: string, controllerLabel: string, editors: ExtHostDocumentsAndEditors) { super({ controllerId, - getDocumentVersion: (uri: URI) => editors.getDocument(uri)?.version, + getDocumentVersion: uri => uri && editors.getDocument(uri)?.version, getApiFor: getPrivateApiFor as (impl: TestItemImpl) => ITestItemApi, getChildren: (item) => item.children as ITestChildrenLike, root: new TestItemRootImpl(controllerId, controllerLabel),