- Error
- Reported by the type checker
TS2739
Type '{0}' is missing the following properties from type '{1}': {2}
An object is missing several required properties of the target type (the message lists them). Add the properties or make them optional.
What it means
The value is assigned to a type that requires properties it doesn't have. The message lists the missing ones. With one missing property the checker uses TS2741; with many, it lists a few and counts the rest (TS2740).
Example
interface Point { x: number; y: number; z: number }
const p: Point = { x: 1 };
export {};
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(2,7): error TS2739: Type '{ x: number; }' is missing the following properties from type 'Point': y, z
Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.
How to fix
- Add the missing properties to the value.
- Mark them optional in the type (
y?: number) if they really are.