2

In my application, I am using declaration merging to customize the Request type from Express.

declare global {
  namespace Express {
    export interface Request {
      base?: BaseServerInfo;
    }
  }
}

The problem is that Jasmine is not picking this up and gives me type errors when I run it. The type errors disappear when I manually copy the declaration code into my tests.

How can I get Jasmine to recognize and pre-load my declaration files?

I've tried adding it to helpers, but this did not work (the path is correct)

{
  "spec_dir": "test",
  "spec_files": ["**/*[sS]pec.ts"],
  "helpers": ["./src/types/_declaration-merging.d.ts"],
  "stopSpecOnExpectationFailure": false,
  "random": true,
  "reporters": [
    {
      "name": "jasmine-spec-reporter#SpecReporter",
      "options": {
        "displayStacktrace": "all"
      }
    }
  ]
} 
CodyBugstein
  • 21,984
  • 61
  • 207
  • 363

0 Answers0