I am facing an issue with my NestJS API while trying to build it using Azure DevOps pipeline. The build fails with the following error:
src/auth/auth.controller.ts(49,7): error TS2322: Type 'false' is not assignable to type 'Date'.
src/auth/auth.controller.ts(73,7): error TS2322: Type 'false' is not assignable to type 'Date'.
The error seems to be originating from this code snippet:
res.cookie('session', session._id, {
httpOnly: true,
signed: true,
expires: false,
secure: true,
});
This error is related to the express response object according to @types/express and IntelliSense.
https://i.stack.imgur.com/wUKvI.png
All packages are being installed from the same Azure artifact feed and the build works fine locally. I'm puzzled as to why this TypeScript error occurs only in the Azure DevOps pipeline.
Interestingly, I have successfully built the project locally with the environment variables properly configured.