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