Skip to Content
Skip to content
236 results
TypeScript
Export Types From a Module Without Runtime Code Level: Intermediate

Compare import type, the inline type keyword and a plain import, and see which ones leave code in the compiled file.

TypeScript
Fix "Type is not assignable" on a Nested Object Level: Intermediate

Read a long assignability error from the bottom, then fix the usual causes: a wrong value, a wrong type and a literal widened to string.

TypeScript
Write a Generic identity and map Without Losing Types Level: Intermediate

Turn two any-typed helpers into generic functions and see what the compiler now catches. After this, a typo or a wrong method on the result is a compile error.

TypeScript
Install @types for a Library That Ships No Types Level: Intermediate

Reproduce the missing declaration error, check whether the library has its own types, install the @types package and prove the types work.

TypeScript
Partial and Required on a Form Draft Object Level: Intermediate

Derive a draft type with Partial, require every field with Required, and write one check that turns a draft into the finished type.

TypeScript
Pick and Omit Without Duplicating an Interface Level: Intermediate

Derive a public type from User with Omit and a short card type with Pick, then close the gap where Omit accepts a misspelled key.

TypeScript
private Fields vs #private: Which One Fits Level: Intermediate

Run the same class with the private keyword and with a hash field, and compare the output, the errors and what outside code can still reach.

TypeScript
Record Keys That Match a Real Enum Level: Intermediate

Key a lookup table by an enum or a union of literals so a missing or misspelled key is a compile error. After this, adding a status shows you every table that needs an entry.

TypeScript
Type JSON from fetch Without as MyType Everywhere Level: Intermediate

Replace scattered casts with one assertion function and one typed fetch helper. After this, a 404 or a changed payload fails with a clear message instead of carrying a wrong type.

TypeScript
unknown First, Then Narrow: Parse an API Payload Level: Intermediate

Receive a nested payload as unknown and narrow it with two small helpers until every property is checked.

TypeScript
Add typescript-eslint to an Existing TS Repo Level: Advanced

Install typescript-eslint on TypeScript 7, switch the rules on as warnings, count them by rule and hold the count down.

TypeScript
Augment Express Request Without Fighting the Compiler Level: Advanced

Add a user property to the Express request type with a module augmentation in one declaration file.