From ca01c72d2a1d25595dc810df6e7b1a64b855778a Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Sat, 3 Mar 2018 23:30:45 +0300 Subject: [PATCH] [atom] File.read can return Promise https://github.com/atom/node-pathwatcher/blob/ea686aeffc33d99445a6480d3eafd477b8738ef8/src/file.coffee#L270 --- types/atom/atom-tests.ts | 3 ++- types/atom/index.d.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/atom/atom-tests.ts b/types/atom/atom-tests.ts index e53e29b176..b295259d79 100644 --- a/types/atom/atom-tests.ts +++ b/types/atom/atom-tests.ts @@ -953,7 +953,8 @@ function testFile() { // Reading and Writing async function readFile() { - str = await file.read(); + const res = await file.read(); + if (res !== null) str = res; } const stream = file.createReadStream(); diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index 9b0d194976..5cc136f7a6 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -3547,7 +3547,7 @@ export class File { // Reading and Writing /** Reads the contents of the file. */ - read(flushCache?: boolean): Promise; + read(flushCache?: boolean): Promise; /** Returns a stream to read the content of the file. */ createReadStream(): ReadStream;