nuxt-security icon indicating copy to clipboard operation
nuxt-security copied to clipboard

Chore/2.0.0 rc.1

Open Baroshem opened this issue 1 year ago • 2 comments
trafficstars

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)

Baroshem avatar May 10 '24 06:05 Baroshem

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

vercel[bot] avatar May 10 '24 06:05 vercel[bot]

Wonderful ! Looking forward to RC release 🎉🎉🎉

vejja avatar May 23 '24 14:05 vejja

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 ?

vejja avatar May 29 '24 09:05 vejja

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;

GalacticHypernova avatar May 29 '24 13:05 GalacticHypernova

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.

vejja avatar May 30 '24 12:05 vejja

Sorry for the late response, sounds good!

GalacticHypernova avatar Jun 02 '24 19:06 GalacticHypernova