Azure devops fails TS build: ' Type 'false' is not assignable to type 'Date': but type is defined as 'Date | boolean' and build works locally

Viewed 161

I have a nestjs based api that I'm trying to build using an Azure devops pipeline, but 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'.

it is originating from here:

    res.cookie('session', session._id, {
      httpOnly: true,
      signed: true,
      expires: false,
      secure: true,
    });

that being an express res, according to @types/express and intellisense:

enter image description here

I am installing all my packages via the exact same azure artifact feed and the build works fine locally.

Why is this TS error wrongfully thrown in azure devops pipeline?

I have also successfuly built locally with the environment variable properly set.

1 Answers

Turns out that what I had installed locally, even though freshly installed from the artifact feed, wasn't really the same version of what got installed during the build pipeline.

I manually updated my local packages to get the exact same error, then simply set the expires of the cookie to 10 years instead of 'false'.

Related