Closed Baroshem closed 3 weeks ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
nuxt-security | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | May 30, 2024 0:41am |
Wonderful ! Looking forward to RC release 🎉🎉🎉
Hi @GalacticHypernova
We have a typescript error on type OptionalThrowError<T> = Pick<T, 'throwError'>;
which prevents the release.
src/types/module.ts(9,38): error TS2344: Type 'string' does not satisfy the constraint 'keyof T'.
Would you mind having a look at this ?
Would you mind having a look at this ?
Looks like TS needs a stricter type constraint. I believe doing something like this will solve it
type OptionalThrowError<T extends Record<string, any>> = 'throwError' extends keyof T ? Pick<T, 'throwError'> : never;
After review, I am setting all fields optional and falling back to default config values in nested route rules.
This is because Nuxt internally forces our NuxtSecurityRouteRules fields to be optional. There is nothing we can do about this, as the Nuxt Module Builder internally overwrite our types with a DeepPartial<>
utility.
This allows the user to use optional fields, while our code thinks they are mandatory - leading to potential type errors. I prefer to let our code know that they are in fact optional, and provide a fallback value.
Sorry for the late response, sounds good!
Types of changes
Description
Closes https://github.com/Baroshem/nuxt-security/pull/441 Closes https://github.com/Baroshem/nuxt-security/issues/447 Closes https://github.com/Baroshem/nuxt-security/issues/444 Closes https://github.com/Baroshem/nuxt-security/issues/446 Closes https://github.com/Baroshem/nuxt-security/issues/433 Closes https://github.com/Baroshem/nuxt-security/issues/232
Checklist: