Skip to content

refactor(helpers): migrate TutorialTimeRemaining to TypeScript#398

Open
shashankcodes1903 wants to merge 1 commit into
c2siorg:developfrom
shashankcodes1903:refactor/migrate-tutorial-time-remaining-to-typescript
Open

refactor(helpers): migrate TutorialTimeRemaining to TypeScript#398
shashankcodes1903 wants to merge 1 commit into
c2siorg:developfrom
shashankcodes1903:refactor/migrate-tutorial-time-remaining-to-typescript

Conversation

@shashankcodes1903
Copy link
Copy Markdown

Description

This pull request migrates the TutorialTimeRemaining helper from JavaScript to TypeScript, improving type safety and code reliability.

Changes

  • Renamed tutorialTime.js to tutorialTime.ts
  • Introduced a Step interface to define the structure of step objects
  • Replaced .splice() with .slice() to prevent unintended mutation of the input array
  • Refactored iteration logic to use .reduce() for improved clarity and functional style
  • Added JSDoc comments for better documentation and maintainability

Related Issue

N/A

Motivation and Context

This change enhances type safety and eliminates potential side effects caused by mutating the original steps array. It also aligns the helper with the project's TypeScript migration efforts and improves overall code readability.

How Has This Been Tested?

  • Performed static type checking using npx tsc --noEmit
  • Verified that the refactored implementation produces the same output as the previous version

Screenshots or GIF (In case of UI changes):

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

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