Skip to content

Conversation

@gwagjiug
Copy link
Contributor

Description

This pull request addresses the unnecessary type casting in the createSafeContext function. The Context.Provider is already correctly typed as T | typeof NullSymbol, so casting it to Provider is redundant and unnecessary. This change improves code readability and maintains type safety without unnecessary type assertions.

Changes

  • Removed the unnecessary type casting of Context.Provider to Provider in the createSafeContext function.

  • Simplified the type declaration to ensure the code is cleaner and easier t

Motivation and Context

This change was made to improve the maintainability of the code. By removing unnecessary type casting, we reduce complexity and make the codebase easier to understand. It's a best practice to avoid redundant type assertions, as they can lead to confusion and errors in the long run.

How Has This Been Tested?

The changes have been manually tested to ensure that the context provider and consumer still function correctly. No functional changes were expected from this update, so existing tests related to context usage were sufficient.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have performed a self-review of my own code.
  • My code is commented, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.

@gwagjiug gwagjiug requested a review from jungpaeng as a code owner April 19, 2025 08:01
@changeset-bot
Copy link

changeset-bot bot commented Apr 19, 2025

🦋 Changeset detected

Latest commit: 99a24df

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
overlay-kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Apr 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
overlay-kit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 22, 2025 8:13am

@codecov-commenter
Copy link

codecov-commenter commented Apr 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.84%. Comparing base (f0f878c) to head (99a24df).
⚠️ Report is 40 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #145   +/-   ##
=======================================
  Coverage   95.84%   95.84%           
=======================================
  Files          12       12           
  Lines         289      289           
  Branches       73       73           
=======================================
  Hits          277      277           
  Misses         10       10           
  Partials        2        2           
Components Coverage Δ
overlay-kit 95.84% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@jungpaeng jungpaeng left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

@jungpaeng jungpaeng merged commit 1a5d4bb into toss:main May 11, 2025
10 checks passed
@github-actions github-actions bot mentioned this pull request May 11, 2025
@gwagjiug gwagjiug deleted the refactor/remove-redundant-casting branch May 11, 2025 15:10
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.

3 participants