Skip to content

chore(types): add Optional utility type and simplify config types#6361

Merged
chenjiahan merged 1 commit intomainfrom
optional_type_1015
Oct 15, 2025
Merged

chore(types): add Optional utility type and simplify config types#6361
chenjiahan merged 1 commit intomainfrom
optional_type_1015

Conversation

@chenjiahan
Copy link
Member

Summary

Improve several config type definitions file to simplify the way optional properties are handled.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings October 15, 2025 03:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new Optional<T, K> utility type to simplify configuration type definitions by making specified properties optional while keeping others required. It refactors several normalized config types to use this new utility instead of verbose combinations of Pick, Omit, Required, and Partial operations.

Key changes:

  • Added Optional<T, K> utility type for cleaner optional property handling
  • Simplified NormalizedServerConfig, NormalizedOutputConfig, NormalizedClientConfig, and MergedEnvironmentConfig type definitions
  • Reduced code complexity while maintaining the same type behavior

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/core/src/types/utils.ts Adds the new Optional<T, K> utility type definition
packages/core/src/types/config.ts Imports and applies the new utility type to simplify multiple config type definitions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@netlify
Copy link

netlify bot commented Oct 15, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit ac0f222
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68ef0ea7e6976f000825affa
😎 Deploy Preview https://deploy-preview-6361--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 69 (🟢 up 9 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@chenjiahan chenjiahan merged commit 475d0dc into main Oct 15, 2025
12 checks passed
@chenjiahan chenjiahan deleted the optional_type_1015 branch October 15, 2025 03:16
@chenjiahan chenjiahan mentioned this pull request Oct 30, 2025
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.

1 participant