From cbf0da65459d8874b222cd345f3a856535ff0936 Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Tue, 2 Jan 2018 23:16:19 +0300 Subject: [PATCH] [atom] atom.workspace.isTextEditor is a type assertion (#22590) --- types/atom/atom-tests.ts | 4 +++- types/atom/index.d.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/atom/atom-tests.ts b/types/atom/atom-tests.ts index 8995bbd3fa..5fc92880f4 100644 --- a/types/atom/atom-tests.ts +++ b/types/atom/atom-tests.ts @@ -3113,7 +3113,9 @@ function testWorkspace() { obj = atom.workspace.createItemForURI("https://test"); - bool = atom.workspace.isTextEditor(obj); + if (atom.workspace.isTextEditor(obj)) { + const textEditor: Atom.TextEditor = obj; + } async function workspaceReopen() { const result = await atom.workspace.reopenItem(); diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index 6cc3a30c77..7ee58bb3b5 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -2697,7 +2697,7 @@ export interface Workspace { createItemForURI(uri: string): Promise; /** Returns a boolean that is true if object is a TextEditor. */ - isTextEditor(object: object): boolean; + isTextEditor(object: object): object is TextEditor; /** * Asynchronously reopens the last-closed item's URI if it hasn't already