Skip to content

Commit

Permalink
fix: build target
Browse files Browse the repository at this point in the history
  • Loading branch information
skarab42 committed Apr 9, 2022
1 parent 06dd582 commit 7deb712
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class PojoError<
readonly type: TType;
readonly args: TArgs;
readonly data: TPojo;
readonly cause?: Error | undefined;
override readonly cause?: Error;

constructor(
type: TType,
Expand All @@ -116,10 +116,13 @@ export class PojoError<
this.type = type;
this.args = args;
this.data = data;
this.cause = options.cause;
this.message = data.message;
this.name = this.constructor.name;

// @ts-expect-error error TS2412: Type 'Error | undefined' is not
// assignable to type 'Error' with 'exactOptionalPropertyTypes: true'.
this.cause = options.cause;

if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, options.constructorOpt);
}
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

"compilerOptions": {
// [Language and Environment]
"target": "ES2015",
"target": "esnext",

// [Modules]
"rootDir": ".",
Expand Down
1 change: 1 addition & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineConfig } from "tsup";
export default defineConfig({
entry: ["src/index.ts"],
format: ["cjs", "esm"],
target: "esnext",
outDir: "dist",
splitting: true,
sourcemap: true,
Expand Down

0 comments on commit 7deb712

Please sign in to comment.