Skip to content
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

[Typescript suggestion] Stricter type checking for persist config #1401

Open
subrapak opened this issue Jul 26, 2022 · 0 comments
Open

[Typescript suggestion] Stricter type checking for persist config #1401

subrapak opened this issue Jul 26, 2022 · 0 comments

Comments

@subrapak
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch redux-persist@6.0.0 for the project I'm working on.

Added stricter type checking for the blacklist and whitelist keys in redux-persist config. According to my understanding, this stricter type checking prevents entering invalid keys/strings as blacklist and whitelist, and also provides autocomplete when adding keys. Interested in hearing any thoughts that disagree, or reasons why this might not be a good change to make!

diff --git a/node_modules/redux-persist/types/types.d.ts b/node_modules/redux-persist/types/types.d.ts
index b3733bc..ac7517d 100644
--- a/node_modules/redux-persist/types/types.d.ts
+++ b/node_modules/redux-persist/types/types.d.ts
@@ -31,8 +31,8 @@ declare module "redux-persist/es/types" {
      * @deprecated keyPrefix is going to be removed in v6.
      */
     keyPrefix?: string;
-    blacklist?: Array<string>;
-    whitelist?: Array<string>;
+    blacklist?: Array<keyof S>;
+    whitelist?: Array<keyof S>;
     transforms?: Array<Transform<HSS, ESS, S, RS>>;
     throttle?: number;
     migrate?: PersistMigrate;

This issue body was partially generated by patch-package.

@subrapak subrapak changed the title [Typescript] Stricter type checking for persist config [Typescript suggestion] Stricter type checking for persist config Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant