diff options
Diffstat (limited to 'std/node/_fs/_fs_appendFile.ts')
-rw-r--r-- | std/node/_fs/_fs_appendFile.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/std/node/_fs/_fs_appendFile.ts b/std/node/_fs/_fs_appendFile.ts index c0f347dbf..c057c1f65 100644 --- a/std/node/_fs/_fs_appendFile.ts +++ b/std/node/_fs/_fs_appendFile.ts @@ -1,5 +1,6 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import { + Encodings, WriteFileOptions, isFileOptions, CallbackWithError, @@ -15,13 +16,13 @@ import { fromFileUrl } from "../path.ts"; export function appendFile( pathOrRid: string | number | URL, data: string, - optionsOrCallback: string | WriteFileOptions | CallbackWithError, + optionsOrCallback: Encodings | WriteFileOptions | CallbackWithError, callback?: CallbackWithError ): void { pathOrRid = pathOrRid instanceof URL ? fromFileUrl(pathOrRid) : pathOrRid; const callbackFn: CallbackWithError | undefined = optionsOrCallback instanceof Function ? optionsOrCallback : callback; - const options: string | WriteFileOptions | undefined = + const options: Encodings | WriteFileOptions | undefined = optionsOrCallback instanceof Function ? undefined : optionsOrCallback; if (!callbackFn) { throw new Error("No callback function supplied"); @@ -79,7 +80,7 @@ function closeRidIfNecessary(isPathString: boolean, rid: number): void { export function appendFileSync( pathOrRid: string | number | URL, data: string, - options?: string | WriteFileOptions + options?: Encodings | WriteFileOptions ): void { let rid = -1; @@ -115,7 +116,7 @@ export function appendFileSync( } function validateEncoding( - encodingOption: string | WriteFileOptions | undefined + encodingOption: Encodings | WriteFileOptions | undefined ): void { if (!encodingOption) return; |