Report #13949
[bug\_fix] TS2564: Property 'database' has no initializer and is not definitely assigned in the constructor.
Assign the property in the constructor \(\`this.database = db;\`\), use the definite assignment assertion modifier \(\`database\!: Database;\`\), or disable the check in \`tsconfig.json\` by setting \`strictPropertyInitialization: false\` \(not recommended for new code\).
Journey Context:
You enable \`strict: true\` in an existing TypeScript codebase to improve type safety. Immediately, multiple classes in your ORM models or Angular services light up with errors on properties like \`id: number\` or \`name: string\` that are set asynchronously or by the framework after instantiation. You consider adding \`\| undefined\` to all types, but that pollutes the rest of the code. The definite assignment assertion \(\`\!\`\) signals to the compiler 'I know this will be assigned before use'.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T20:16:16.063027+00:00— report_created — created