HackIndia Logo
HackathonsNewsSkillsGrowth
HackIndia LogoContact: +91 9910125804

General

  • Companies
  • Colleges
  • Board of Advisors
  • Brand Ambassadors
  • FAQ
  • Contact
  • Report a Bug

Hackathons

  • Upcoming Hackathons
  • Judges
  • Mentors
  • Partners
  • Participating Colleges

Resources

  • About Us
  • Branding
  • Latest News
  • Growth
  • Skills
  • Ecosystem
  • Forum
  • Ideas
  • Prompt Optimizer
  • How to earn XP

© 2026 HackIndia. All rights reserved.

Privacy PolicyTerms of ServiceCode of ConductSitemap

Build 2.139 · 09 Nov 2026, 10:59 UTC

    HackIndia
    HackathonsNewsInternshipsSkillsGrowth
    TypeScriptWorking towardsTypeScript
    0%

    0 of 10 steps done · +100 XP · +50 SHARP when it is yours

    1. 1Why types save demos4 min · +10 XP · +5 SHARP
    2. 2Set up TypeScript cleanly4 min · +10 XP · +5 SHARP
    3. 3Use basic and union types4 min · +10 XP · +5 SHARP
    4. 4Model data with aliases and interfaces4 min · +10 XP · +5 SHARP
    5. 5Type functions that do work5 min · +10 XP · +5 SHARP
    6. 6Use generics without overdoing it5 min · +10 XP · +5 SHARP
    7. 7Read errors before using any4 min · +10 XP · +5 SHARP
    8. 8Submit your typed project repo5 min · +10 XP · +5 SHARP
    9. The check10 questions, 7 to pass · +10 SHARP
    10. Hand in the taskA project that uses the skill
    11. Skill and certificate+100 XP · +50 SHARP
    Lesson 2 of 8 4 min

    TypeScript

    Set up TypeScript cleanly

    • +10 XP for this lesson
    • +100 XP when the skill is proved
    • 3 learning it right now
    In 30 seconds
    • Install TypeScript in a JavaScript project without changing everything at once.
    • Create a clean tsconfig.json for a small app you can build in public.
    Add npm scripts so recruiters can see type-check and build results.
    Key point

    One clean rule

    Set up TypeScript as a project tool, not a global shortcut. Keep it in devDependencies, commit the config, and run it through npm scripts.

    This makes your repo work on your laptop, your teammate’s laptop, and a recruiter’s machine.

    What setup means

    TypeScript needs two things: the TypeScript package and a tsconfig.json file. The package gives you the compiler. The config tells it what files to read and how strict to be.

    In this lesson, you will not convert every file yet. You will prepare the project so later lessons can add types safely.

    Your to-do

    Install TypeScript

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    npm init -y
    npm install --save-dev typescript
    npx tsc --version
    Example

    Small tsconfig

    Create tsconfig.json at the project root. This is a safe starting point for a small app.

    It checks your source files, writes build output to dist, and avoids checking installed packages.

    {
      "compilerOptions": {
        "target": "ES2020",
        "module": "ES2020",
        "moduleResolution": "Bundler",
        "rootDir": "src",
        "outDir": "dist",
        "strict": true,
        "noEmitOnError": true,
        "skipLibCheck": true
      },
      "include": ["src"]
    }
    Tip

    Start with src

    Put your app code inside a src folder. Keep generated files in dist. This gives your repo a clean shape that is easy to inspect.

    If your app already has files in the root, move one small file into src first. Do not reorganise everything five minutes before a hackathon demo.

    Example

    Add scripts

    Your README should later show the same commands you use locally. Add scripts now so type-checking is one command.

    For a basic TypeScript project, typecheck checks only. build checks and writes JavaScript into dist.

    {
      "scripts": {
        "typecheck": "tsc --noEmit",
        "build": "tsc"
      },
      "devDependencies": {
        "typescript": "^5.0.0"
      }
    }
    Common mistake

    Avoid global installs

    Do not depend on npm install -g typescript for your project. It may work on your laptop and fail for someone else.

    Use npm install --save-dev typescript and run npx tsc or npm run typecheck. That proves the repo carries its own setup.

    Your to-do

    Do this now

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    npm run typecheck
    npm run build

    Quick check

    0 of 2 right
    1.Your teammate clones your repo before a college demo. What makes TypeScript setup work on their machine too?
    2.You want a command that checks types but does not create dist files. Which script should you use?

    Answer the quick check to finish this lesson.

    ← Lesson 1Skip to lesson 3 →
    TypeScript
    Working towards
    TypeScript +100 XP

    0 of 8 lessons done · proved by a project that uses the skill

    See the track