Fix results TypeScript types (#86)

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
This commit is contained in:
Juan Pinilla
2019-06-08 00:40:28 -05:00
committed by Adam Reis
parent 9808759e1f
commit 8fe55fc2bc

8
types/index.d.ts vendored
View File

@@ -1,11 +1,11 @@
declare module 'replace-in-file' {
function replaceInFile(config: ReplaceInFileConfig): Promise<ReplaceResults>;
function replaceInFile(config: ReplaceInFileConfig, cb: (error: Error, results: ReplaceResults) => void): void;
function replaceInFile(config: ReplaceInFileConfig): Promise<ReplaceResult[]>;
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,