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

feat(module): improve app config types autocomplete #1870

Merged
merged 4 commits into from
Jul 9, 2024

Conversation

davestewart
Copy link
Contributor

@davestewart davestewart commented Jun 13, 2024

πŸ”— Linked issue

Resolves #1869

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR enables full component config auto-completion in app.config.ts:

CleanShot 2024-06-13 at 11 42 10

The existing Utility class used object and so auto-completion would fail below the top level.

This new implementation of DeepPartial:

  • uses recursive typing to supply full auto-complete of nested properties
  • allows custom properties to be added, for example in variant
  • allows new properties to be optionally constrained, in this case to string

It seems this is the only usage of DeepPartial in the project, so I assume it won't mess up anything else.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@davestewart
Copy link
Contributor Author

davestewart commented Jun 13, 2024

@benjamincanac, one thing to note...

In the original DeepPartial (which does work, sorry; I should have looked more closely) known properties are suggested like this:

CleanShot 2024-06-13 at 14 09 53

In the version I propose, the typing is tighter:

CleanShot 2024-06-13 at 14 11 55

CleanShot 2024-06-13 at 14 28 42

I suspect your TS-fu is greater than mine... but worth mentioning.

@benjamincanac benjamincanac changed the title feat(Config): full theming autocompletion for app config feat(module): improve app config types autocomplete Jul 9, 2024
@benjamincanac
Copy link
Member

It does look better with your suggestion! Thanks 😊

@benjamincanac benjamincanac merged commit 3f8ea5d into nuxt:dev Jul 9, 2024
1 of 2 checks passed
binhtranhuu pushed a commit to binhtranhuu/nuxt-ui that referenced this pull request Jul 28, 2024
Co-authored-by: Dave Stewart <dev@davestewart.co.uk>
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
@davestewart davestewart deleted the app-config-autocomplete branch August 2, 2024 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better app config theme auto-complete
2 participants