10000 types: avoid overriding app runtime config namespace by danielroe Β· Pull Request #1333 Β· nitrojs/nitro Β· GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

types: avoid overriding app runtime config namespace #1333

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

Merged
merged 6 commits into from
Jun 21, 2023
Merged

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

❓ 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

Currently it's not possible to augment runtimeConfig.app whilst also using Nitro types for runtime config.

This PR makes it possible to augment app. It also exposes the nitro type. (I can also make augmentation disallowed for this if that is desirable.)

πŸ“ Checklist

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

@danielroe danielroe added the bug Something isn't working label Jun 21, 2023
@danielroe danielroe requested a review from pi0 June 21, 2023 16:16
@danielroe danielroe self-assigned this Jun 21, 2023
@codecov
Copy link
codecov bot commented Jun 21, 2023

Codecov Report

Merging #1333 (ae07485) into main (606fc1c) will increase coverage by 0.02%.
The diff coverage is 100.00%.

❗ Current head ae07485 differs from pull request most recent head 49e16d6. Consider uploading reports for the commit 49e16d6 to get more accurate results

@@            Coverage Diff             @@
##             main    #1333      +/-   ##
==========================================
+ Coverage   76.74%   76.77%   +0.02%     
==========================================
  Files          71       71              
  Lines        7181     7190       +9     
  Branches      710      710              
==========================================
+ Hits         5511     5520       +9     
  Misses       1669     1669              
  Partials        1        1              
Impacted Files Coverage Ξ”
src/options.ts 94.44% <100.00%> (+0.01%) ⬆️
src/types/nitro.ts 100.00% <100.00%> (ΓΈ)

8000
@@ -31,11 +31,19 @@ export type NitroDynamicConfig = Pick<
"runtimeConfig" | "routeRules"
>;

export interface NitroRuntimeConfigApp {
baseURL: string;
[key: string]: unknown;
Copy link
Member
@pi0 pi0 Jun 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Untyped keys were any since before 2.5. Changing any to unknown (at least for me) is a breaking change. When users where depending on any type it will basically break their type checks even if safer or better. Can we override it for nuxt?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems Nuxt itself is still any

image image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made change to make PR mergeable. Would be happy to discuss about next steps plan of adopting unknown...

@pi0 pi0 changed the title fix: avoid overriding app runtime config namespace types: avoid overriding app runtime config namespace Jun 21, 2023
@pi0 pi0 merged commit b926dd0 into main Jun 21, 2023
@pi0 pi0 deleted the fix/runtime-config-app branch June 21, 2023 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0