nuxt-security
nuxt-security copied to clipboard
Chore/2.0.0 rc.1
Types of changes
- [ ] Bug fix (a non-breaking change which fixes an issue)
- [ ] New feature (a non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
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:
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes (if not applicable, please state why)
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!