From 8d0be22327fd0f85a7b28d4a4553b09ef7301459 Mon Sep 17 00:00:00 2001 From: Juan Pinilla Date: Fri, 7 Jun 2019 22:45:02 -0500 Subject: [PATCH] Fix results TypeScript types Types differ from the actual response, the result is an array for both sync and async methods https://github.com/adamreisnz/replace-in-file/blob/master/lib/replace-in-file.spec.js#L230-L240 https://github.com/adamreisnz/replace-in-file/blob/master/lib/replace-in-file.spec.js#L939-L948 --- types/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 725b9b6..0d7a43d 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,11 +1,11 @@ declare module 'replace-in-file' { - function replaceInFile(config: ReplaceInFileConfig): Promise; - function replaceInFile(config: ReplaceInFileConfig, cb: (error: Error, results: ReplaceResults) => void): void; + function replaceInFile(config: ReplaceInFileConfig): Promise; + function replaceInFile(config: ReplaceInFileConfig, cb: (error: Error, results: ReplaceResult[]) => void): void; export default replaceInFile; namespace replaceInFile { - export function sync(config: ReplaceInFileConfig): ReplaceResults; + export function sync(config: ReplaceInFileConfig): ReplaceResult[]; } export interface ReplaceInFileConfig { @@ -19,7 +19,7 @@ declare module 'replace-in-file' { dry?:boolean } - export interface ReplaceResults { + export interface ReplaceResult { file: string; hasChanged: boolean; numMatches?: number,