The demo problem
JavaScript lets you move fast. It also lets small wrong assumptions reach your demo.
A value from a form is a string. An API field may be missing. A function may return null when your UI expects text. These bugs often appear only when a judge clicks a path you did not test.
One idea
TypeScript does not make your app correct. It makes many bad assumptions visible before you run the app.
Think of it as a build-time check for your JavaScript decisions.
Bug before demo
This JavaScript looks fine until the data shape changes. A college event app might receive this from a local JSON file or a simple backend.
// JavaScript
function formatEvent(event) {
return event.title.toUpperCase() + " at " + event.venue.name;
}
const eventFromApi = {
title: "HackIndia Meetup",
venue: null
};
console.log(formatEvent(eventFromApi));
// Runtime crash: Cannot read properties of nullType catches it
With TypeScript, you describe what the function needs. If venue can be null, the code must handle it before the build or type-check passes.
type Venue = {
name: string;
};
type Event = {
title: string;
venue: Venue | null;
};
function formatEvent(event: Event) {
return event.title.toUpperCase() + " at " + event.venue.name;
// TypeScript warns: event.venue is possibly null
}What types help with
Types are useful when your app has moving parts: forms, API responses, user roles, payments, project cards, filters, routes, and database records.
For a hackathon repo, typed code also shows reviewers that you thought about data, not only screens.
Common wrong belief
Beginners think TypeScript is only for large company codebases. It is also useful for a 2-day hackathon app.
The smaller the team, the more you need simple checks. You may be coding at 2 am, tired, after classes or labs. Types catch boring mistakes when your brain does not.
Use AI carefully
You can ask ChatGPT, Gemini, or Claude to convert a small file to TypeScript. Do not paste it blindly.
Check that the AI did not hide errors with any, remove useful null checks, or invent fields that your real data does not have.
Prompt you can use:
Convert this JavaScript file to TypeScript.
Keep the same behaviour.
Add types for function inputs and returned values.
Do not use any unless there is no better safe type.
Explain every type you add in 5 short bullets.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