mirror of
https://github.com/zhigang1992/replace-in-file.git
synced 2026-04-30 21:52:29 +08:00
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:
8
types/index.d.ts
vendored
8
types/index.d.ts
vendored
@@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
declare module 'replace-in-file' {
|
declare module 'replace-in-file' {
|
||||||
function replaceInFile(config: ReplaceInFileConfig): Promise<ReplaceResults>;
|
function replaceInFile(config: ReplaceInFileConfig): Promise<ReplaceResult[]>;
|
||||||
function replaceInFile(config: ReplaceInFileConfig, cb: (error: Error, results: ReplaceResults) => void): void;
|
function replaceInFile(config: ReplaceInFileConfig, cb: (error: Error, results: ReplaceResult[]) => void): void;
|
||||||
export default replaceInFile;
|
export default replaceInFile;
|
||||||
|
|
||||||
namespace replaceInFile {
|
namespace replaceInFile {
|
||||||
export function sync(config: ReplaceInFileConfig): ReplaceResults;
|
export function sync(config: ReplaceInFileConfig): ReplaceResult[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ReplaceInFileConfig {
|
export interface ReplaceInFileConfig {
|
||||||
@@ -19,7 +19,7 @@ declare module 'replace-in-file' {
|
|||||||
dry?:boolean
|
dry?:boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ReplaceResults {
|
export interface ReplaceResult {
|
||||||
file: string;
|
file: string;
|
||||||
hasChanged: boolean;
|
hasChanged: boolean;
|
||||||
numMatches?: number,
|
numMatches?: number,
|
||||||
|
|||||||
Reference in New Issue
Block a user