Skip to content
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

Migrate to TypeScript #2725

Open
ImBIOS opened this issue Dec 12, 2024 · 3 comments
Open

Migrate to TypeScript #2725

ImBIOS opened this issue Dec 12, 2024 · 3 comments
Labels
good first issue A GitHub standard for inviting (new) contributors *Congratulations in advance!* help wanted Just an old github standard we add automatically. (The team can remove it when working on it.) Philosophy Structures (UX & ORG & Teamwork) Let's focus on structure! Everything should be as easily seen/found as it is relevant. up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥

Comments

@ImBIOS
Copy link

ImBIOS commented Dec 12, 2024

PROBLEM:
The current project is written in JavaScript, which lacks strong typing. Which can often lead to runtime errors, make debugging harder, and reduce confidence when refactoring or adding new features. Collaboration also becomes more challenging without clear type definitions.

SOLUTION:
Migrate the codebase to TypeScript to introduce static typing, improve code quality, and enhance developer productivity. TypeScript provides better tooling support, type safety, and clearer documentation through type annotations.

ALTERNATIVES:

  1. Use JSDoc to add type annotations to JavaScript, but it lacks the full capabilities of TypeScript.
  2. Incrementally adopt TypeScript by converting only critical parts of the codebase.
  3. Use a superset like Flow instead of TypeScript, but it has less community adoption and tooling.

RELEVANCE / SCOPE:
This migration is highly beneficial for long-term projects with growing complexity and teams that require better maintainability and fewer bugs. It aligns well with modern JavaScript/TypeScript ecosystems.

"SIDE EFFECTS":

  1. The migration process might initially slow development due to the need for refactoring and resolving type errors.
  2. Developers unfamiliar with TypeScript will require training or onboarding.
  3. Tooling and library support for TypeScript must be ensured, which could involve upgrading dependencies.

CONTEXT:
Migrating to TypeScript ensures long-term stability, improves collaboration by enforcing clear contracts between components, and makes the codebase more robust. It's an investment in maintainability, scalability, and reduced debugging time.


SHORT Table (Summary)
Problem Lack of strong typing leads to runtime errors and harder debugging.
Solution Migrate the codebase to TypeScript for better type safety and tooling support.
Alternatives Use JSDoc, incremental migration, or Flow.
Scope Useful for long-term, complex projects or teams working collaboratively.
Side effects Slower initial development, training, and tooling/library updates required.
Context Enhances stability, maintainability, and collaboration for the project.

@ImBIOS ImBIOS added Feature request Wish or idea good first issue A GitHub standard for inviting (new) contributors *Congratulations in advance!* help wanted Just an old github standard we add automatically. (The team can remove it when working on it.) up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥ labels Dec 12, 2024
@Gaur97shiv
Copy link

Problem --> Lack of strong typing leads to runtime errors and harder debugging. can you any example where you are getting runtime errors

@4yman-0
Copy link

4yman-0 commented Dec 12, 2024

Migrate the codebase to TypeScript ... enhance developer productivity

This migration is highly beneficial for long-term projects with growing complexity and teams that require better maintainability and fewer bugs.

Unfortunately, the build system and file structure can make this difficult. And this will require a Version 5 of the extension on its own because the API will change a lot. Remember, this extension has many, many users and a very good reputation.

Possible solution: Host an experimental v5 somewhere to do ALL THE REWRITES while the others fix endless bugs caused by completely proprietary JavaScript.

Edit: My v5 branch is in branch v5.

@ImprovedTube ImprovedTube added Structures (UX & ORG & Teamwork) Let's focus on structure! Everything should be as easily seen/found as it is relevant. Philosophy and removed Feature request Wish or idea labels Dec 12, 2024
@ImprovedTube
Copy link
Member

hi and thanks! @ImBIOS @4yman-0 @Gaur97shiv

  • 1. Documentation for developers

you might like this search: (language:js stars:>3000 pushed:>2024-09-14 size:>1000)

We don't have a lot of variables yet, with more than one purpose or private data
(, but mostly only a collection of many little independent things.)

Yes you could identify some things in the code, which may be nice with TS, and how to search & replace to get to TS
With (bidirectional) github actions one could sync / uniting JS and TS authors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue A GitHub standard for inviting (new) contributors *Congratulations in advance!* help wanted Just an old github standard we add automatically. (The team can remove it when working on it.) Philosophy Structures (UX & ORG & Teamwork) Let's focus on structure! Everything should be as easily seen/found as it is relevant. up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥
Projects
None yet
Development

No branches or pull requests

4 participants