Here are Top 75 TypeScript Interview Questions for Fresher Level (very important for Angular +
React jobs too):
✅ Basic TypeScript Questions
1. What is TypeScript?
Answer:
TypeScript is a superset of JavaScript developed by Microsoft that adds static typing.
2. Why use TypeScript?
Type safety
Better debugging
Cleaner code
Better IDE support
3. Difference between JavaScript and TypeScript?
JavaScript TypeScript
Dynamic Static typing
No compilation Needs compilation
Less strict More strict
4. What is static typing?
Answer:
Variables have fixed types.
let age: number = 20;
5. How does TypeScript compile?
Answer:
It converts .ts files into .js using compiler (tsc).
6. What is [Link]?
Answer:
Configuration file for TypeScript compiler.
7. What is Type Inference?
Answer:
TypeScript automatically detects type.
let name = "Neha"; // string inferred
8. What are Data Types in TypeScript?
string
number
boolean
any
void
null
undefined
9. What is any type?
Answer:
Allows any type of value.
10. Difference between any and unknown?
any unknown
No type checking Safe type checking
✅ Variables & Functions
11. Difference between let, const, var?
(Already same as JS but stricter)
12. What are functions in TypeScript?
function add(a: number, b: number): number {
return a + b;
}
13. What is optional parameter?
function greet(name?: string) {}
14. What are default parameters?
function greet(name: string = "User") {}
15. What is arrow function?
const add = (a: number, b: number): number => a + b;
✅ Object Oriented Programming
16. What is Class?
class Person {
17. What is Object?
Answer: Instance of a class.
18. What is Constructor?
constructor(name: string) {}
19. What is Inheritance?
class A {}
class B extends A {}
20. What is Encapsulation?
Answer: Hiding internal data using access modifiers.
21. What are Access Modifiers?
public
private
protected
22. What is Polymorphism?
Answer: Same method behaves differently.
23. What is Abstraction?
Answer: Hiding implementation details.
✅ Interfaces & Types
24. What is Interface?
interface User {
name: string;
age: number;
25. Difference between Interface and Type?
Interface Type
Extendable Not always extendable
Object only Any type
26. What is Type Alias?
type ID = number | string;
27. Can interface extend another interface?
Yes.
28. Can interface implement class?
No.
29. What is Optional Property?
interface User {
age?: number;
}
30. What is Readonly property?
readonly id: number;
✅ Advanced Types
31. Union Types
let value: string | number;
32. Intersection Types
type A = {name: string};
type B = {age: number};
type C = A & B;
33. Literal Types
let direction: "left" | "right";
34. Tuple
let user: [string, number];
35. Enum
enum Role {
Admin,
User
36. Any vs Unknown vs Never?
any → disables checking
unknown → safe any
never → never returns
37. What is Never type?
function error(): never {
throw new Error();
✅ Functions Advanced
38. Function Overloading
function add(a: number, b: number): number;
function add(a: string, b: string): string;
39. Rest Parameters
function sum(...nums: number[]) {}
40. Arrow function this behavior?
No own this.
✅ Generics
41. What are Generics?
function identity<T>(arg: T): T {
return arg;
42. Why use Generics?
Reusability + type safety.
43. Generic Array
let arr: Array<number>;
44. Generic Interface
interface Box<T> {
value: T;
}
45. Generic Class
class Box<T> {}
✅ Modules
46. What is Module?
Export/import system.
47. export keyword
export class A {}
48. import keyword
import { A } from './file';
49. Default export
export default class A {}
50. Named export vs default export?
Named Default
Multiple exports One export
✅ DOM + Browser
51. TypeScript with DOM
[Link]("id") as HTMLInputElement;
52. Type assertion
let x = value as string;
53. Non-null assertion
value!.toString();
54. Event typing
function handle(e: Event) {}
55. Mouse event example
function click(e: MouseEvent) {}
✅ Error Handling
56. try-catch
try {} catch (e) {}
57. Error type in TS?
catch (e: unknown)
58. Why use unknown in catch?
Safer than any.
✅ Utility Types
59. Partial
Makes all properties optional.
60. Required
Makes all required.
61. Readonly
Makes all properties readonly.
62. Pick
Select properties.
63. Omit
Remove properties.
64. Record<K,V>
Record<string, number>
65. ReturnType
Gets function return type.
66. Parameters
Gets function parameters.
✅ Compilation & Config
67. What is tsc?
TypeScript compiler.
68. What is watch mode?
tsc -w
69. What is strict mode?
Enforces strict typing rules.
70. What is target in tsconfig?
Defines JS version output.