Courses
TypeScript Intermediate: Types That Survive Real Projects
Check Yourself: Working With Code You Didn't Write
Five scenario questions on declaration files, types packages and typing fetch results. If you miss more than one, reread the lessons in this section.
Course content
Join this Course
Sign in to save your progress.
-
Generics Without the Fog
-
Generic Functions That Keep the Input Type
-
Generic Types for Lists, Results and Caches
-
-
-
Types That Transform Other Types
-
Utility Types: Partial, Pick, Omit and Record
-
Mapped Types You Can Actually Read
-
-
-
Working With Code You Didn't Write
-
@types Packages and When DefinitelyTyped Is Wrong
-
Typing fetch JSON Without Lying to Yourself
-
-
-
Classes and Modules in TypeScript
-
Classes With public, private and protected
-
Modules, Exports and Avoiding Circular Types
-
-
-
Strictness That Pays Off
-
unknown vs any and Safe Parsing
-
Discriminated Unions for API Responses That Vary
-
-
- Final Check: TypeScript Intermediate
1.
You install lodash, import it in a TypeScript file in strict mode, and tsc reports TS7016, could not find a declaration file for the module. What does the message mean?
Strict mode does not support libraries written in JavaScript.
lodash is not installed, so run npm install again.
The import is wrong, and it should use require instead.
The compiler found the JavaScript but nothing that describes its types. Install the types package, or add a declaration file as a stopgap.
2.
You run npm view on a library with the field name types, and it prints nothing. What is the next step?
3.
A declaration file says findRate returns number, but the real code returns undefined for a currency it does not know. A line calls findRate for EUR and then calls toFixed on the result. What is the safest fix?
4.
A function calls fetch, then returns the parsed body with an as Todo cast. The server answers 404 with an empty object. What does the caller get?
5.
You write function isTodo with a parameter of type unknown and a return type of value is Todo. What does that return type tell the compiler?
About
Five scenario questions on declaration files, types packages and typing fetch results. If you miss more than one, reread the lessons in this section.
- Duration
- 5 min
- Last update
- 10/14/2026
Was this helpful?
0
0
Comments (0)
Sign in to commentNo comments yet.