summaryrefslogtreecommitdiffstats
path: root/test/types/header.test-d.ts
blob: 38ac9f6afdc4fe7e68c1e3992fa39f04ce883929 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { IncomingHttpHeaders as CoreIncomingHttpHeaders } from "http";
import { expectAssignable, expectNotAssignable } from "tsd";
import { IncomingHttpHeaders } from "../../types/header";

const headers = {
  authorization: undefined,
  ["content-type"]: "application/json",
} satisfies CoreIncomingHttpHeaders;

expectAssignable<IncomingHttpHeaders>(headers);

// It is why we do not need to add ` | null` to `IncomingHttpHeaders`:
expectNotAssignable<CoreIncomingHttpHeaders>({
  authorization: null,
  ["content-type"]: "application/json",
});