To improve code quality and catch potential issues early, Fireorm should enable stricter TypeScript rules. The goal is to gradually migrate the codebase to comply with strict: true settings in tsconfig.json.
Steps to Reproduce
Enable strict TypeScript rules in tsconfig.json.
Attempt to compile the Fireorm codebase.
Identify and fix TypeScript errors that arise from stricter type checking.
Expected Behavior
The Fireorm codebase should compile without errors under strict TypeScript rules, ensuring better type safety and code quality.
Actual Behavior
The current codebase may not compile under strict TypeScript rules due to various type-related issues.
Acceptance Criteria
Enable strict TypeScript rules incrementally, addressing errors on a folder-by-folder or file-by-file basis.
Ensure the entire codebase eventually complies with strict: true settings.
Improve overall type safety and code quality in Fireorm.
Additional Context
July 4, 2020: Initial interest in tackling the stricter TypeScript rules.
July 5, 2020: Agreement on the need for stricter rules and the scope of the task.
July 11, 2020: Suggestion to take an incremental approach to the migration.
July 12, 2020: Ongoing work on a PR to address many existing errors.
July 18, 2020: PR merged to address a significant number of errors.
July 31, 2020: Initial part of strict rules migration merged.
August 17, 2020: Plan to address strict rules on a folder-by-folder basis with a detailed list of pending work.
Proposed Plan
Incremental Approach:
Migrate to strict TypeScript rules incrementally, focusing on one folder or file at a time.
Use an inner tsconfig.json to enable strict rules for specific folders or files and fix the errors.
Folder-by-Folder Migration:
Address the following folders and files in sequence:
src/Batch/
src/Errors/
src/Transaction/
src/AbstractFirestoreRepository.ts
src/BaseFirestoreRepository.ts
src/BaseRepository.ts
src/helpers.ts
src/MetadataStorage.ts
src/QueryBuilder.ts
src/utils.ts
Final Integration:
After migrating all folders and files, remove the inner tsconfig.json.
Enable strict: true in the outer tsconfig.json.
Example Implementation
// Update tsconfig.json to enable strict rules
{
"compilerOptions": {
// other options...
"strict": true
},
"include": [
"src/**/*.ts"
]
}
// Fix TypeScript errors in migrated files
export class ExampleClass {
// Ensure all properties are properly typed
private exampleProperty: string;
constructor(exampleProperty: string) {
this.exampleProperty = exampleProperty;
}
}
Description
To improve code quality and catch potential issues early, Fireorm should enable stricter TypeScript rules. The goal is to gradually migrate the codebase to comply with
strict: true
settings intsconfig.json
.Steps to Reproduce
tsconfig.json
.Expected Behavior
The Fireorm codebase should compile without errors under strict TypeScript rules, ensuring better type safety and code quality.
Actual Behavior
The current codebase may not compile under strict TypeScript rules due to various type-related issues.
Acceptance Criteria
strict: true
settings.Additional Context
Proposed Plan
Incremental Approach:
tsconfig.json
to enable strict rules for specific folders or files and fix the errors.Folder-by-Folder Migration:
src/Batch/
src/Errors/
src/Transaction/
src/AbstractFirestoreRepository.ts
src/BaseFirestoreRepository.ts
src/BaseRepository.ts
src/helpers.ts
src/MetadataStorage.ts
src/QueryBuilder.ts
src/utils.ts
Final Integration:
tsconfig.json
.strict: true
in the outertsconfig.json
.Example Implementation
Original Issue