better-custom-error
Advanced tools
Comparing version
@@ -6,3 +6,9 @@ All notable changes to this project will be documented in this file. | ||
## [4.0.0] - 2021-05-15 | ||
## [4.0.1] - 2021-04-15 | ||
### Fixed | ||
- possible fix for TypeScript issues when using library, see: https://github.com/microsoft/TypeScript/issues/15300 | ||
### Dev | ||
- some deps version bump | ||
## [4.0.0] - 2021-02-15 | ||
### Added | ||
@@ -9,0 +15,0 @@ - TypeScript support |
declare type Names = (string | Names)[]; | ||
declare type Data = Record<string, unknown>; | ||
interface Data { | ||
} | ||
interface CustomError extends Error { | ||
@@ -4,0 +5,0 @@ names: Names; |
@@ -1,8 +0,8 @@ | ||
import type { Arg, CustomError } from "../types"; | ||
import type { Arg, CustomError, Data } from "../types"; | ||
declare const parseArguments: (...args: Arg[]) => { | ||
sourceError: CustomError | Error | undefined; | ||
message: string | undefined; | ||
details: Record<string, unknown> | undefined; | ||
details: Data | undefined; | ||
}; | ||
export { parseArguments, }; | ||
//# sourceMappingURL=parseArguments.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import type { CustomError, Names } from "../types"; | ||
import type { CustomError, Data, Names } from "../types"; | ||
declare const getMessage: (error?: CustomError | Error | undefined, message?: string | undefined) => string; | ||
declare const getDetails: (error?: CustomError | Error | undefined, details?: Record<string, unknown> | undefined) => Record<string, unknown>; | ||
declare const getDetails: (error?: CustomError | Error | undefined, details?: Data | undefined) => Data; | ||
declare const getPrototypesNames: (obj: any) => string[]; | ||
@@ -5,0 +5,0 @@ declare const enhanceToString: (array: Names) => Names; |
declare type Names = (string | Names)[]; | ||
declare type Data = Record<string, unknown>; | ||
interface Data { | ||
} | ||
interface CustomError extends Error { | ||
@@ -4,0 +5,0 @@ names: Names; |
@@ -1,8 +0,8 @@ | ||
import type { Arg, CustomError } from "../types"; | ||
import type { Arg, CustomError, Data } from "../types"; | ||
declare const parseArguments: (...args: Arg[]) => { | ||
sourceError: CustomError | Error | undefined; | ||
message: string | undefined; | ||
details: Record<string, unknown> | undefined; | ||
details: Data | undefined; | ||
}; | ||
export { parseArguments, }; | ||
//# sourceMappingURL=parseArguments.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import type { CustomError, Names } from "../types"; | ||
import type { CustomError, Data, Names } from "../types"; | ||
declare const getMessage: (error?: CustomError | Error | undefined, message?: string | undefined) => string; | ||
declare const getDetails: (error?: CustomError | Error | undefined, details?: Record<string, unknown> | undefined) => Record<string, unknown>; | ||
declare const getDetails: (error?: CustomError | Error | undefined, details?: Data | undefined) => Data; | ||
declare const getPrototypesNames: (obj: any) => string[]; | ||
@@ -5,0 +5,0 @@ declare const enhanceToString: (array: Names) => Names; |
{ | ||
"name": "better-custom-error", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"repository": "git@github.com:dzek69/better-custom-error.git", | ||
@@ -30,3 +30,3 @@ "author": "Jacek Nowacki @dzek69 <git-public@dzek.eu>", | ||
"main": "./dist/index.js", | ||
"types": "./esm/index.d.js", | ||
"types": "./esm/index.d.ts", | ||
"module": "./esm/index.js", | ||
@@ -40,3 +40,3 @@ "type": "module", | ||
"@dzek69/eslint-config-base": "^2.0.0", | ||
"@dzek69/eslint-config-typescript": "^0.2.2", | ||
"@dzek69/eslint-config-typescript": "^0.2.4", | ||
"@typescript-eslint/eslint-plugin": "^4.11.1", | ||
@@ -51,4 +51,4 @@ "@typescript-eslint/parser": "^4.11.1", | ||
"ts-node": "^9.0.0", | ||
"typedoc": "^0.20.4", | ||
"typescript": "^4.1.2" | ||
"typedoc": "^0.20.35", | ||
"typescript": "^4.2.4" | ||
}, | ||
@@ -61,3 +61,3 @@ "husky": { | ||
"libraryTemplate": { | ||
"version": "0.0.2-beta.5", | ||
"version": "3.0.2", | ||
"language": "typescript", | ||
@@ -64,0 +64,0 @@ "fixDefaultForCommonJS": true |
type Names = (string | Names)[]; | ||
type Data = Record<string, unknown>; | ||
interface Data {} | ||
@@ -5,0 +5,0 @@ /** |
@@ -8,9 +8,8 @@ import type { CustomError, Data, Names } from "../types"; | ||
const getMessage = (error?: Error | CustomError, message?: string): string => { | ||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
return message || (error?.message) || ""; | ||
}; | ||
const getDetails = (error?: Error | CustomError, details?: Record<string, unknown>) => { | ||
const getDetails = (error?: Error | CustomError, details?: Data) => { | ||
// @ts-expect-error Yes TS, I know | ||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing,@typescript-eslint/no-unnecessary-condition | ||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
return details || (error?.details as Data) || null; | ||
@@ -17,0 +16,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
346472
0.42%4114
0.54%0
-100%