- Error
- Reported by the type checker
TS2717
Subsequent property declarations must have the same type. Property '{0}' must be of type '{1}', but here has type '{2}'.
A property is declared again (in a merged interface or declaration) with a different type. Give every declaration the same type.
What it means
When interfaces or other declarations merge, a property that appears in more than one of them must have the identical type each time.
Example
interface Options { timeout: number }
interface Options { timeout: string }
export {};
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(2,21): error TS2717: Subsequent property declarations must have the same type. Property 'timeout' must be of type 'number', but here has type 'string'.
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
- Make every declaration of the property use the same type.
- If the property needs to accept both, declare it once with a union type.