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

Fix typing for KeyConfiguration #205

Open
kpaxton opened this issue Oct 4, 2021 · 1 comment
Open

Fix typing for KeyConfiguration #205

kpaxton opened this issue Oct 4, 2021 · 1 comment
Labels

Comments

@kpaxton
Copy link

kpaxton commented Oct 4, 2021

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.

@BBlackwo BBlackwo added the types label Nov 8, 2021
@FuturistiCoder
Copy link

I have the same issue.
my workaround is adding //@ts-ignore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants