From d3d14153fbbb391dd9680a063599f4e2ea65f04d Mon Sep 17 00:00:00 2001 From: Emily Marigold Klassen Date: Tue, 9 Jul 2019 13:15:54 -0700 Subject: [PATCH] fix: ensure that generated dts is compatible with --strictNullChecks --- package.json | 3 ++- src/Responses.ts | 2 +- test/index.ts | 1 + tsconfig.json | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 test/index.ts diff --git a/package.json b/package.json index 6101784..82dc743 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "build": "rm -rf dist && mkdir dist && tsc --declaration --outDir dist --rootDir src", "build:example": "rm -rf dist && mkdir dist && tsc --declaration --outDir dist --project example.tsconfig.json", "start": "npm run build:example && node dist/example/index.js", - "prepublish": "npm run build" + "test": "tsc --noEmit --strictNullChecks test/index.ts --moduleResolution node", + "prepublish": "npm run build && npm test" }, "repository": { "type": "git", diff --git a/src/Responses.ts b/src/Responses.ts index 63e020b..e27580c 100644 --- a/src/Responses.ts +++ b/src/Responses.ts @@ -3,5 +3,5 @@ import { Reference } from './Reference'; export interface Responses { default?: Response | Reference; - [httpStatusCode: string]: Response | Reference; + [httpStatusCode: string]: Response | Reference | undefined; } diff --git a/test/index.ts b/test/index.ts new file mode 100644 index 0000000..88743d2 --- /dev/null +++ b/test/index.ts @@ -0,0 +1 @@ +import {odata2openapi} from '../dist' diff --git a/tsconfig.json b/tsconfig.json index 9ebef56..a302081 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,6 +12,7 @@ }, "exclude": [ "dist", + "test", "node_modules", "example" ]