This project is a simple word transformation tool built with HTML, CSS, and JavaScript. The goal of this exercise is to refactor the existing code into TypeScript.
index.html: The main HTML filestyles.css: Contains all the styling for the applicationword-transformer.js: Contains the JavaScript logic for word transformation
- Set up TypeScript in the project
- Convert
word-transformer.jsto TypeScript - Add type annotations to improve code quality and catch potential errors
- Ensure the refactored TypeScript code works as expected
- Install TypeScript globally:
npm install -g typescript - Initialize a
tsconfig.jsonfile:tsc --init - Adjust
tsconfig.jsonas needed (e.g., set"target": "es6")
- Rename
word-transformer.jstoword-transformer.ts - Do the changes to make it Typescript great! 💃🏼
- Run
tscto compile the TypeScript file to JavaScript - Update the
<script>tag inindex.htmlto point to the compiled JS file
- Open
index.htmlin a browser and test all functionalities - Fix any issues that arise during testing
- Look for opportunities to use more advanced TypeScript features
- Start by adding basic type annotations (string, number, etc.)
- Use the
anytype sparingly and only when necessary - Take advantage of TypeScript's static typing to catch potential errors early
- TypeScript Documentation
- TypeScript Playground for quick experimentation
Good luck with the refactoring!