Skip to content

SSF-131/138 Strict Mode#105

Open
Juwang110 wants to merge 32 commits intomainfrom
jw/SSF-131-strict-mode
Open

SSF-131/138 Strict Mode#105
Juwang110 wants to merge 32 commits intomainfrom
jw/SSF-131-strict-mode

Conversation

@Juwang110
Copy link

ℹ️ Issue

Closes https://vidushimisra.atlassian.net/jira/software/projects/SSF/boards/1?selectedIssue=SSF-131 and
https://vidushimisra.atlassian.net/jira/software/projects/SSF/boards/1?selectedIssue=SSF-138

📝 Description

This PR enables typescript strict mode in the backend which enables the compiler to be a lot more picky and strict with types, null and undefined checks, etc. The PR includes changes to make our backend adhere with all the rules that strict mode enforces. This involved work making entity fields optional or required, and also handling null/undefined errors and return values.

✔️ Verification

I made sure all the backend tests pass and npx nx serve backend properly runs without error.

🏕️ (Optional) Future Work / Notes

N/A

@dburkhart07 dburkhart07 self-requested a review February 15, 2026 21:15
@sam-schu sam-schu self-requested a review February 15, 2026 21:56
Copy link

@dburkhart07 dburkhart07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial changes

Copy link
Collaborator

@sam-schu sam-schu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First half of review

describe('POST /create', () => {
it('should call requestsService.create and return the created food request', async () => {
const createBody: Partial<FoodRequest> = {
const createBody = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the cast necessary here or can we just type this object normally?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In reply to this, I think this cast is necessary. Even if we are typing the object normally, now this has no type.

"compilerOptions": {
"esModuleInterop": true
"esModuleInterop": true,
"strict": true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very epic and awesome line of code right here that I am very excited for !!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any package.json changes?

Copy link
Collaborator

@sam-schu sam-schu Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Juwang110 How come we have changes to the yarn lock but not the package.json?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, not sure, will look into that

@Juwang110 Juwang110 requested a review from sam-schu February 20, 2026 15:38
@dburkhart07
Copy link

Gonna wait on Sam's approval before I do a final review I think!

@Juwang110 Juwang110 requested a review from sam-schu February 24, 2026 19:33
Copy link
Collaborator

@sam-schu sam-schu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!!
STRICT MODEEEEEEEEEEEEE

@Juwang110 Juwang110 requested a review from amywng February 24, 2026 19:56
Copy link

@dburkhart07 dburkhart07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few questions and inconsistencies that need to be cleared up.

Also, can we change I realized I should've made this a DTO but thought it would be good to do here. Can we take the SendEmailDTO in types.ts in the emails directory, put it in a DTO folder, and change the 2 max lengths to be Lenght(1, 255)

allocationId: number;
allocationId!: number;

@Column({ name: 'order_id', type: 'int', nullable: false })

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have nullable: false for a required field? This seems inconsistent, and something I'd imagine we would put for all required fields, or no required fields (theres many others throughout this entity and other ones that do not have a nullable property anywhere).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the default is nullable: false unless nullable: true is specified. So specifying nullable: false is the same as essentially not typing anything.

Copy link

@dburkhart07 dburkhart07 Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe im missing something, but why cant we just delete it then? right now it seems inconsistently used throughout our join tables within entities, as well as entity id fields.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I can delete it

Copy link
Author

@Juwang110 Juwang110 Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a note, nullable: true is the default for relationships in entities, so i left those but deleted all uneccessary instances of nullable: false

describe('POST /create', () => {
it('should call requestsService.create and return the created food request', async () => {
const createBody: Partial<FoodRequest> = {
const createBody = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In reply to this, I think this cast is necessary. Even if we are typing the object normally, now this has no type.

Copy link

@dburkhart07 dburkhart07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few more small things. I know there's a big merge conflict that needs to be resolved, but hopefully after that it should be good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants