Skip to content

Commit 43fc3bd

Browse files
authored
fix(types): add explicit | undefined to optional fields (#462)
When typescript is used with the option `exactOptionalProperty: true`, this code fails to typecheck if `undefined` is passed in for the response value. This is because `exactOptionalProperty` makes tsc consider `?:..` different from `: ... | undefined` for more strictness.
1 parent cd5dc6e commit 43fc3bd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class RequestError extends Error {
2020
/**
2121
* Response object if a response was received
2222
*/
23-
response?: OctokitResponse<unknown>;
23+
response?: OctokitResponse<unknown> | undefined;
2424

2525
constructor(
2626
message: string,

src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { RequestOptions, OctokitResponse } from "@octokit/types";
22

33
export type RequestErrorOptions = {
4-
response?: OctokitResponse<unknown>;
4+
response?: OctokitResponse<unknown> | undefined;
55
request: RequestOptions;
66
};

0 commit comments

Comments
 (0)