This project demonstrates basic TypeScript usage for frontend development, including:
- Defining interfaces
- Creating typed objects
- Storing data in arrays
- Rendering content dynamically using Vanilla JavaScript
The goal of this task is to render a table of students and their locations in the browser using TypeScript, compiled and bundled with Webpack.
frontend-javascript/
ββ 0x04-TypeScript/
ββ task_0/
ββ js/
β ββ main.ts # TypeScript code
ββ package.json # Project dependencies
ββ tsconfig.json # TypeScript configuration
ββ webpack.config.js # Webpack configuration
ββ .eslintrc.js # ESLint configuration
-
TypeScript Interface
-
Student
interface with the following properties:firstName
(string)lastName
(string)age
(number)location
(string)
-
-
Student Array
- Two student objects are created and stored in a
studentsList
array.
- Two student objects are created and stored in a
-
Dynamic Table Rendering
- Vanilla JavaScript is used to create a table and render each student's
firstName
andlocation
.
- Vanilla JavaScript is used to create a table and render each student's
-
Webpack Integration
- TypeScript code is bundled using Webpack for browser usage.
- Clone the repository:
git clone <repository_url>
cd frontend-javascript/0x04-TypeScript/task_0
- Install dependencies:
npm install
- Start development server:
npx webpack serve
- The project will be available at
http://localhost:9000/
- Build for production:
npx webpack --mode production
- The
main.ts
file defines theStudent
interface and student objects. - A table is created dynamically in the DOM using Vanilla JS.
- Webpack compiles the TypeScript code into
dist/bundle.js
for browser usage.
- Ensure
node_modules
is ignored in Git using.gitignore
. - Compatible with Node 18+ for the latest TypeScript and Webpack versions.