DevAcademy

TypeScript Beginner Practice

36 questions covering 12 TypeScript topics.

Quick Quiz

1. What is TypeScript?

2. Do browsers run TypeScript files directly?

3. What happens to TypeScript’s type annotations at runtime?

4. Which command compiles a TypeScript file into JavaScript?

5. What does tsconfig.json do?

6. What does the strict compiler option do?

7. How many distinct numeric types does TypeScript have for integers and decimals?

8. How do you type an array of strings?

9. What does strictNullChecks do?

10. What is the key difference between an array and a tuple in TypeScript?

11. Which of these correctly types a tuple of [string, number]?

12. What does a rest element in a tuple, like ...results: number[], allow?

13. What value do numeric enum members get by default?

14. Do string enum members get default values?

15. Unlike interfaces, what happens to a regular enum at compile time?

16. What is the key difference between any and unknown?

17. What does the never type represent?

18. What return type would a function that only logs a message and returns nothing have?

19. Does TypeScript require an explicit annotation for every variable?

20. What type is inferred for an array like [1, "two", 3]?

21. What does noImplicitAny do?

22. What keyword creates a type alias?

23. Can a type alias describe a union of types?

24. Does a type alias create a genuinely new, distinct type?

25. What does an interface describe?

26. What is structural typing?

27. How does one interface inherit members from another?

28. What happens if a parameter has a default value?

29. What does a rest parameter (...args: number[]) collect?

30. What are function overloads used for?

31. What does string | number mean for a variable?

32. What does an intersection type (A & B) require?

33. What is a discriminated union?

34. What does the literal type "success" allow as a value?

35. How is a const string variable typically inferred, compared to a let variable?

36. What does the as const assertion do to an object?