Currently working on a web server project with nest.js!
Here's a snippet of code from my controller file:
@Delete('users/:id/courses/:course_id')
deleteUserCourses(
@Param() { id, course_id }: { id: number; course_id: string },
) {
return this.usersService.deleteUserCourses(id, course_id);
}
Recently, I tried sending a delete request to "/users/123/courses/math",
Expecting an error due to the string type of variables id and course_id.
Surprisingly, no error was displayed.
Could this be because TypeScript doesn't check variable types at runtime?
Or are there other reasons that type checking is not happening?
Grateful for any insights or suggestions.