Socket
Socket
Sign inDemoInstall

defekt

Package Overview
Dependencies
Maintainers
5
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

defekt - npm Package Compare versions

Comparing version 7.3.1 to 7.3.2

16

build/lib/Result.d.ts
interface ResultBase<TValue, TError extends Error> {
hasError: () => this is ResultError<TError> & ResultBase<any, TError>;
hasValue: () => this is ResultValue<TValue> & ResultBase<TValue, any>;
hasError: () => this is ResultError<TValue, TError>;
hasValue: () => this is ResultValue<TValue, TError>;
unwrapOrThrow: (errorTransformer?: (err: TError) => Error) => TValue;

@@ -8,15 +8,15 @@ unwrapOrElse: (handleError: (error: Error) => TValue) => TValue;

}
interface ResultError<TError extends Error> {
interface ResultError<TValue, TError extends Error> extends ResultBase<TValue, TError> {
error: TError;
}
declare const error: <TError extends Error>(err: TError) => ResultError<TError> & ResultBase<any, TError>;
interface ResultValue<TValue> {
declare const error: <TValue, TError extends Error>(err: TError) => ResultError<TValue, TError>;
interface ResultValue<TValue, TError extends Error> extends ResultBase<TValue, TError> {
value: TValue;
}
declare const value: {
<TValue extends undefined>(): ResultValue<TValue> & ResultBase<TValue, any>;
<TValue>(value: TValue): ResultValue<TValue> & ResultBase<TValue, any>;
<TValue extends undefined, TError extends Error>(): ResultValue<TValue, TError>;
<TValue, TError extends Error>(value: TValue): ResultValue<TValue, TError>;
};
declare type Result<TValue, TError extends Error> = ResultBase<TValue, TError>;
declare type Result<TValue, TError extends Error> = ResultValue<TValue, TError> | ResultError<TValue, TError>;
export type { ResultValue, ResultError, Result };
export { value, error };

@@ -0,1 +1,8 @@

## [7.3.2](https://github.com/thenativeweb/defekt/compare/7.3.1...7.3.2) (2021-07-23)
### Bug Fixes
* Remove type information discarding. ([#332](https://github.com/thenativeweb/defekt/issues/332)) ([bfa3e56](https://github.com/thenativeweb/defekt/commit/bfa3e56d2c8394a7968ffb05d6c52e614f3b3522))
## [7.3.1](https://github.com/thenativeweb/defekt/compare/7.3.0...7.3.1) (2021-07-12)

@@ -2,0 +9,0 @@

interface ResultBase<TValue, TError extends Error> {
hasError: () => this is ResultError<TError> & ResultBase<any, TError>;
hasValue: () => this is ResultValue<TValue> & ResultBase<TValue, any>;
hasError: () => this is ResultError<TValue, TError>;
hasValue: () => this is ResultValue<TValue, TError>;

@@ -10,7 +10,7 @@ unwrapOrThrow: (errorTransformer?: (err: TError) => Error) => TValue;

interface ResultError<TError extends Error> {
interface ResultError<TValue, TError extends Error> extends ResultBase<TValue, TError> {
error: TError;
}
const error = function <TError extends Error>(err: TError): ResultError<TError> & ResultBase<any, TError> {
const error = function <TValue, TError extends Error>(err: TError): ResultError<TValue, TError> {
return {

@@ -30,6 +30,6 @@ hasError (): boolean {

},
unwrapOrElse<TValue> (handleError: (error: TError) => TValue): TValue {
unwrapOrElse (handleError: (error: TError) => TValue): TValue {
return handleError(err);
},
unwrapOrDefault<TValue> (defaultValue: TValue): TValue {
unwrapOrDefault (defaultValue: TValue): TValue {
return defaultValue;

@@ -41,3 +41,3 @@ },

interface ResultValue<TValue> {
interface ResultValue<TValue, TError extends Error> extends ResultBase<TValue, TError> {
value: TValue;

@@ -47,5 +47,5 @@ }

const value: {
<TValue extends undefined>(): ResultValue<TValue> & ResultBase<TValue, any>;
<TValue>(value: TValue): ResultValue<TValue> & ResultBase<TValue, any>;
} = function <TValue>(val?: TValue): ResultValue<TValue | undefined> & ResultBase<TValue | undefined, any> {
<TValue extends undefined, TError extends Error>(): ResultValue<TValue, TError>;
<TValue, TError extends Error>(value: TValue): ResultValue<TValue, TError>;
} = function <TValue, TError extends Error>(val?: TValue): ResultValue<TValue | undefined, TError> {
return {

@@ -71,3 +71,3 @@ hasError (): boolean {

type Result<TValue, TError extends Error> = ResultBase<TValue, TError>;
type Result<TValue, TError extends Error> = ResultValue<TValue, TError> | ResultError<TValue, TError>;

@@ -74,0 +74,0 @@ export type {

{
"name": "defekt",
"version": "7.3.1",
"version": "7.3.2",
"description": "defekt is custom errors made simple.",

@@ -35,3 +35,3 @@ "contributors": [

"devDependencies": {
"assertthat": "6.3.6",
"assertthat": "6.3.7",
"roboter": "11.7.7",

@@ -38,0 +38,0 @@ "semantic-release-configuration": "2.0.5"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc