New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing type for processor
in ReplaceInFileConfig
#170
Comments
Hi, if you are referring to typescript types, I haven't been managing those, but you're welcome to submit a PR to fix if needed. Thanks! |
Cool, I'll have a look! Who maintained these before, do you know? Maybe makes sense to coordinate. If they're just not really maintained at all currently... it should be a quick fix! |
I am not sure, you could look at the past PR's related to typescript. Not really maintained though, so you're welcome to take charge! |
Cool, I'll have a go, then! |
hi, what happened to this? i am not sure how to fix this using typescript? |
Hey @lodossDev, we're still living with a local patch for this, as I haven't found the time to investigate this more in-depth. Don't want to contribute something that's working for us, but nobody else :D If you're feeling experimental, you can try the patch we're currently using: diff --git a/node_modules/replace-in-file/types/index.d.ts b/node_modules/replace-in-file/types/index.d.ts
index 97409d5..bd88df2 100644
--- a/node_modules/replace-in-file/types/index.d.ts
+++ b/node_modules/replace-in-file/types/index.d.ts
@@ -1,7 +1,5 @@
declare module 'replace-in-file' {
- export function replaceInFile(config: ReplaceInFileConfig): Promise<ReplaceResult[]>;
- export function replaceInFile(config: ReplaceInFileConfig, cb: (error: Error, results: ReplaceResult[]) => void): void;
export default replaceInFile;
namespace replaceInFile {
@@ -11,9 +9,6 @@ declare module 'replace-in-file' {
export function replaceInFile(config: ReplaceInFileConfig, cb: (error: Error, results: ReplaceResult[]) => void): void;
}
- export function sync(config: ReplaceInFileConfig): ReplaceResult[];
- export function replaceInFileSync(config: ReplaceInFileConfig): ReplaceResult[];
-
export type From = string | RegExp | FromCallback;
export type To = string | ToCallback; We're applying it using https://www.npmjs.com/package/patch-package |
I have a pr for this, but not permissions to the repo if someone wants to add me. Fwiw OP is correct. I also cleaned up the syntax of the type to make it consistent. |
You can simply submit your PR and I will review/approve it, thank you! |
Thank you a lot, @zach-babb-ef 🙌 |
I think this one is just plain missing, right? Same for the array version of it?
https://github.com/adamreisnz/replace-in-file#custom-processor
https://github.com/adamreisnz/replace-in-file/blob/main/types/index.d.ts#L20-L31
... and after a small patch attempt locally... probably also need to make
from
andto
optional, then?Maybe this could be done more elegantly with some type of discriminator?
This looks interesting: https://stackoverflow.com/a/49265354
The text was updated successfully, but these errors were encountered: