ngrx-store-localstorage icon indicating copy to clipboard operation
ngrx-store-localstorage copied to clipboard

Fix typing for KeyConfiguration

Open kpaxton opened this issue 2 years ago • 1 comments

The type for KeyConfiguration doesn't allow for a child key to contain a simple string next to other KeyConfigurations.

keys: [
      { doorway: ['settings'] },
      'router',
      {
        jwtAuth: [
          { jwt: ['sub', 'subjectDn'] },
          'token',
          {
            userPreferences: ['darkMode', 'acknowledgedCompliance']
          }
        ]
      }
    ],

It errors out on token saying it's not assignable to type of KeyConfiguration.

If I modify the type to be

interface KeyConfiguration {
    [key: string]: Keys | Options | ((key: string, value: any) => any);
}

Then it all seems to work just fine. Might need more testing with some other deep object scenarios, but it seems to work so far for me in the case above.

kpaxton avatar Oct 04 '21 19:10 kpaxton