Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix(nitro, nuxi): add runtimeConfig types (for #config and useRuntimeConfig()) #1783

Merged
merged 14 commits into from
Nov 10, 2021

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

resolves nuxt/nuxt#12837

❓ 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 like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR:

  • adds support for shimming #config in Nitro routes
  • adds initial docs for useRuntimeConfig()
  • adds support for typing privateRuntimeConfig & publicRuntimeConfig

Note, the way I've implemented this allows us in future to automatically type runtime config.

πŸ“ Checklist

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

@danielroe danielroe requested a review from pi0 November 8, 2021 10:41
@danielroe danielroe self-assigned this Nov 8, 2021
@netlify
Copy link

netlify bot commented Nov 8, 2021

βœ”οΈ Deploy Preview for nuxt3-docs canceled.

πŸ”¨ Explore the source changes: ce90b23

πŸ” Inspect the deploy log: https://app.netlify.com/sites/nuxt3-docs/deploys/618a729d1a567900076ac6df

@danielroe danielroe added bug Something isn't working documentation Improvements or additions to documentation nitro labels Nov 8, 2021
@danielroe danielroe changed the title fix(nitro, nuxi): add runtimeConfig types (for #config) fix(nitro, nuxi): add runtimeConfig types (for #config and useRuntimeConfig()) Nov 8, 2021
@pi0 pi0 added enhancement New feature or request and removed bug Something isn't working labels Nov 8, 2021
Co-authored-by: Tobias Diez <code@tobiasdiez.com>
@tobiasdiez tobiasdiez mentioned this pull request Nov 8, 2021
38 tasks
Co-authored-by: Tobias Diez <code@tobiasdiez.com>
Co-authored-by: Tobias Diez <code@tobiasdiez.com>
@tobiasdiez
Copy link
Contributor

I hope it's okay to use this PR for a related question: how does one use #config in jest tests? If one of the tests (indirectly) tries to import #config then this obviously fails without any further setup.

@danielroe
Copy link
Member Author

@tobiasdiez you would likely want to use moduleNameMapper to point it to a stub.

@pi0 pi0 merged commit 13a8e2b into main Nov 10, 2021
@pi0 pi0 deleted the fix/nitro-config-types branch November 10, 2021 12:40
@danielroe danielroe added the 3.x label Jan 19, 2023
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.x documentation Improvements or additions to documentation enhancement New feature or request nitro
Projects
None yet
Development

Successfully merging this pull request may close these issues.

It looks like #config isn't defined for TypeScript?
3 participants