cf.completefrontend

Predict the typesHard

This .d.ts file was meant to add brandColor to shop-ui's Theme. What does TypeScript report in app.ts?

shop-ui is an npm package that ships its own types: an exported Theme interface with a fontSize, and a createTheme function. A teammate added src/shop-ui.d.ts to give Theme a brandColor. Name every error TypeScript reports in src/app.ts, and the type the ^? line points at.

node_modules/shop-ui/package.json
{ "name": "shop-ui", "version": "1.0.0", "types": "index.d.ts" }
node_modules/shop-ui/index.d.ts
export interface Theme {
  fontSize: number;
}
 
export declare function createTheme(theme: Theme): Theme;
src/shop-ui.d.ts
declare module "shop-ui" {
  interface Theme {
    brandColor: string;
  }
}
What does TypeScript report here? (src/app.ts)
import { createTheme, type Theme } from "shop-ui"; type ThemeKeys = keyof Theme;//   ^?const theme: Theme = { fontSize: 14, brandColor: "teal" };

Work it out first: the compiler shows every error and type.

The answer

Work out every error TypeScript reports and every type it shows, line by line. Then check.

Checking your sign-in…