@thisisagile/easy 10.11.14 → 10.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,4 +9,4 @@ export declare class Weight extends Struct {
9
9
  between: (lower: Weight, upper?: Weight) => boolean;
10
10
  sum: (add: Weight) => Weight;
11
11
  }
12
- export declare const weight: (value: number, uow?: UnitOfWeight | undefined) => Weight;
12
+ export declare const weight: (value: number, uow?: UnitOfWeight) => Weight;
@@ -18,5 +18,5 @@ export declare class Url extends Value {
18
18
  constructor(value: unknown, options?: UrlOptions | undefined);
19
19
  get isValid(): boolean;
20
20
  }
21
- export declare const url: (url: unknown, options?: UrlOptions | undefined) => Url;
22
- export declare const isUrl: (url?: unknown, options?: UrlOptions | undefined) => boolean;
21
+ export declare const url: (url: unknown, options?: UrlOptions) => Url;
22
+ export declare const isUrl: (url?: unknown, options?: UrlOptions) => boolean;
@@ -7,9 +7,9 @@ export declare class CacheControl {
7
7
  static OneSecond: () => CacheControl;
8
8
  static fiveSeconds: () => CacheControl;
9
9
  static tenSeconds: () => CacheControl;
10
- static custom: (maxAge: number, staleWhileRevalidate?: number | undefined) => CacheControl;
10
+ static custom: (maxAge: number, staleWhileRevalidate?: number) => CacheControl;
11
11
  maxAge: (a: number) => this;
12
- staleWhileRevalidate: (s?: number | undefined) => this;
12
+ staleWhileRevalidate: (s?: number) => this;
13
13
  value: () => string;
14
14
  name: string;
15
15
  }
@@ -6,4 +6,4 @@ export declare class OriginatedError extends Error {
6
6
  constructor(origin: ErrorOrigin, options?: VerbOptions | undefined);
7
7
  }
8
8
  export declare const isOriginatedError: (e?: unknown) => e is OriginatedError;
9
- export declare const toOriginatedError: (e: unknown, options?: VerbOptions | undefined) => OriginatedError;
9
+ export declare const toOriginatedError: (e: unknown, options?: VerbOptions) => OriginatedError;
@@ -1,6 +1,6 @@
1
1
  import { Enum, PageOptions, Text } from '../types';
2
2
  import { ContentType } from './ContentType';
3
- export declare const toPageOptions: (options?: RequestOptions | PageOptions | undefined) => PageOptions | undefined;
3
+ export declare const toPageOptions: (options?: RequestOptions | PageOptions) => PageOptions | undefined;
4
4
  export declare class RequestOptions extends Enum {
5
5
  readonly type: ContentType;
6
6
  readonly headers: {
@@ -15,8 +15,8 @@ export declare type RestResult = {
15
15
  };
16
16
  };
17
17
  export declare const rest: {
18
- toData: (status: HttpStatus, items?: Json[], totalItems?: number | undefined) => RestResult;
18
+ toData: (status: HttpStatus, items?: Json[], totalItems?: number) => RestResult;
19
19
  toError: (status: HttpStatus, errors?: Result[]) => RestResult;
20
- to: (payload?: any | any[], status?: HttpStatus | undefined) => RestResult;
20
+ to: (payload?: any | any[], status?: HttpStatus) => RestResult;
21
21
  };
22
22
  export declare const isRestResult: (r: unknown) => r is RestResult;
@@ -10,11 +10,11 @@ export declare type Verb = {
10
10
  verb: HttpVerb;
11
11
  options: VerbOptions;
12
12
  };
13
- export declare const toVerbOptions: (options?: VerbOptions | undefined) => Required<VerbOptions>;
14
- export declare const get: (options?: VerbOptions | undefined) => PropertyDecorator;
15
- export declare const search: (options?: VerbOptions | undefined) => PropertyDecorator;
16
- export declare const put: (options?: VerbOptions | undefined) => PropertyDecorator;
17
- export declare const patch: (options?: VerbOptions | undefined) => PropertyDecorator;
18
- export declare const post: (options?: VerbOptions | undefined) => PropertyDecorator;
19
- export declare const del: (options?: VerbOptions | undefined) => PropertyDecorator;
20
- export declare const stream: (options?: VerbOptions | undefined) => PropertyDecorator;
13
+ export declare const toVerbOptions: (options?: VerbOptions) => Required<VerbOptions>;
14
+ export declare const get: (options?: VerbOptions) => PropertyDecorator;
15
+ export declare const search: (options?: VerbOptions) => PropertyDecorator;
16
+ export declare const put: (options?: VerbOptions) => PropertyDecorator;
17
+ export declare const patch: (options?: VerbOptions) => PropertyDecorator;
18
+ export declare const post: (options?: VerbOptions) => PropertyDecorator;
19
+ export declare const del: (options?: VerbOptions) => PropertyDecorator;
20
+ export declare const stream: (options?: VerbOptions) => PropertyDecorator;
@@ -4,11 +4,11 @@ import { Req } from '../resources';
4
4
  export declare class Search<T extends Struct> {
5
5
  protected repo: Repo<T>;
6
6
  constructor(repo: Repo<T>);
7
- all: (options?: PageOptions | undefined) => Promise<PageList<T>>;
7
+ all: (options?: PageOptions) => Promise<PageList<T>>;
8
8
  byId: (id: Id) => Promise<T>;
9
9
  byIds: (...ids: Id[]) => Promise<PageList<T>>;
10
- byKey: (key: Key, options?: PageOptions | undefined) => Promise<PageList<T>>;
10
+ byKey: (key: Key, options?: PageOptions) => Promise<PageList<T>>;
11
11
  query: ({ query, skip, take }: Req) => Promise<PageList<T>>;
12
- search: (query: JsonValue, options?: PageOptions | undefined) => Promise<PageList<T>>;
12
+ search: (query: JsonValue, options?: PageOptions) => Promise<PageList<T>>;
13
13
  exists: (id: Id) => Promise<boolean>;
14
14
  }
@@ -5,7 +5,7 @@ interface SignOptions {
5
5
  }
6
6
  export declare class Jwt extends Value implements Validatable {
7
7
  get isValid(): boolean;
8
- static sign: (token: Json, options?: SignOptions | undefined) => Jwt;
8
+ static sign: (token: Json, options?: SignOptions) => Jwt;
9
9
  static of: (a: {
10
10
  jwt: string;
11
11
  }) => Jwt;
@@ -6,9 +6,15 @@ declare class CaseBuilder<V> {
6
6
  type<T, U = unknown>(guard: (u: unknown) => u is U, out: Func<T, U>): Case<T, V>;
7
7
  is: {
8
8
  defined: <T>(prop: Func<unknown, V>, out: Func<T, V>) => Case<T, V>;
9
+ not: {
10
+ defined: <T_1>(prop: Func<unknown, V>, out: Func<T_1, V>) => Case<T_1, V>;
11
+ };
9
12
  };
10
13
  if: {
11
14
  defined: <T>(prop: Func<unknown, V>, out: Func<T, V>) => Case<T, V>;
15
+ not: {
16
+ defined: <T_1>(prop: Func<unknown, V>, out: Func<T_1, V>) => Case<T_1, V>;
17
+ };
12
18
  };
13
19
  }
14
20
  declare class Case<T, V = unknown> {
@@ -19,9 +25,15 @@ declare class Case<T, V = unknown> {
19
25
  type<U>(guard: (u: unknown) => u is U, out: Func<T, U>): Case<T, V>;
20
26
  is: {
21
27
  defined: (prop: Func<unknown, V>, out: Func<T, V>) => Case<T, V>;
28
+ not: {
29
+ defined: (prop: Func<unknown, V>, out: Func<T, V>) => Case<T, V>;
30
+ };
22
31
  };
23
32
  if: {
24
33
  defined: (prop: Func<unknown, V>, out: Func<T, V>) => Case<T, V>;
34
+ not: {
35
+ defined: (prop: Func<unknown, V>, out: Func<T, V>) => Case<T, V>;
36
+ };
25
37
  };
26
38
  else(alt: Get<T, V>): T;
27
39
  }
@@ -7,6 +7,9 @@ class CaseBuilder {
7
7
  this.v = v;
8
8
  this.is = {
9
9
  defined: (prop, out) => new Case(this.v).case((0, index_1.isDefined)(prop(this.v)), out),
10
+ not: {
11
+ defined: (prop, out) => new Case(this.v).case(!(0, index_1.isDefined)(prop(this.v)), out),
12
+ }
10
13
  };
11
14
  this.if = this.is;
12
15
  }
@@ -23,6 +26,9 @@ class Case {
23
26
  this.outcome = outcome;
24
27
  this.is = {
25
28
  defined: (prop, out) => new Case(this.value).case((0, index_1.isDefined)(prop(this.value)), out),
29
+ not: {
30
+ defined: (prop, out) => new Case(this.value).case(!(0, index_1.isDefined)(prop(this.value)), out),
31
+ }
26
32
  };
27
33
  this.if = this.is;
28
34
  }
@@ -51,6 +57,9 @@ class Found extends Case {
51
57
  this.outcome = outcome;
52
58
  this.is = {
53
59
  defined: (_prop, _out) => this,
60
+ not: {
61
+ defined: (_prop, _out) => this,
62
+ }
54
63
  };
55
64
  this.if = this.is;
56
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Case.js","sourceRoot":"","sources":["../../src/types/Case.ts"],"names":[],"mappings":";;;AAAA,mCAAwE;AAExE,MAAM,WAAW;IACf,YAAqB,CAAI;QAAJ,MAAC,GAAD,CAAC,CAAG;QAUzB,OAAE,GAAG;YACH,OAAO,EAAE,CAAI,IAAsB,EAAE,GAAe,EAAc,EAAE,CAAC,IAAI,IAAI,CAAO,IAAI,CAAC,CAAC,CAAC,CAAC,IA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,GAAL,KAAK,CAAG;QAAY,YAAO,GAAP,OAAO,CAAG;QAYpD,OAAE,GAAG;YACH,OAAO,EAAE,CAAC,KAAuB,EAAE,IAAgB,EAAc,EAAE,CAAC,IAAI;YACxE,GAAG,EAAE;gBACH,OAAO,EAAE,CAAC,KAAuB,EAAE,IAAgB,EAAc,EAAE,CAAC,IAAI;aACzE;SACF,CAAC;QAEF,OAAE,GAAG,IAAI,CAAC,EAAE,CAAC;IAjBb,CAAC;IAED,IAAI,CAAC,IAAkB,EAAE,GAAe;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAI,KAA6B,EAAE,GAAe;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IAWD,IAAI,CAAC,GAAc;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAEM,MAAM,MAAM,GAAG,CAAI,KAAQ,EAAE,EAAE,CAAC,IAAI,WAAW,CAAI,KAAK,CAAC,CAAC;AAApD,QAAA,MAAM,UAA8C"}
@@ -12,7 +12,7 @@ export declare class DotEnvContext implements EnvContext {
12
12
  readonly name: string;
13
13
  readonly host: string;
14
14
  readonly port: number;
15
- readonly get: (key: string, alt?: string | undefined) => string | undefined;
15
+ readonly get: (key: string, alt?: string) => string | undefined;
16
16
  }
17
17
  export interface RequestContext {
18
18
  token?: any;
@@ -16,5 +16,5 @@ export declare class Exception extends Enum {
16
16
  static readonly EnvironmentVariableNotFound: (variable: Text) => Exception;
17
17
  because: (reason: Text) => Exception;
18
18
  }
19
- export declare const isException: (e?: unknown, t?: Text | undefined) => e is Exception;
19
+ export declare const isException: (e?: unknown, t?: Text) => e is Exception;
20
20
  export declare const isDoesNotExist: (e?: unknown) => e is Exception;
@@ -14,6 +14,6 @@ export declare const isFunction: (o?: unknown) => o is (...params: unknown[]) =>
14
14
  export declare const isArray: <T = any>(o?: unknown) => o is T[];
15
15
  export declare const isInstance: <T>(ctor: Constructor<T>, o?: unknown) => o is T;
16
16
  export declare const isIn: (o: unknown, values: unknown[]) => boolean;
17
- export declare const isIntersecting: (o?: unknown[] | undefined, values?: unknown[] | undefined) => boolean;
17
+ export declare const isIntersecting: (o?: unknown[], values?: unknown[]) => boolean;
18
18
  export declare const isPrimitive: (o?: unknown) => boolean;
19
19
  export declare const isError: (e: unknown) => e is Error;
@@ -7,7 +7,7 @@ declare class ClassMeta {
7
7
  get: <T>(key: string) => T;
8
8
  set: <T>(key: string, value: T) => T;
9
9
  entries: <T = unknown>() => List<[key: string, value: T]>;
10
- properties: (key?: string | undefined) => List<PropertyMeta>;
10
+ properties: (key?: string) => List<PropertyMeta>;
11
11
  keys: <T = any>(key: string) => List<T>;
12
12
  values: <T = unknown>() => List<T>;
13
13
  property: (property: string | symbol) => PropertyMeta;
@@ -1,2 +1,2 @@
1
1
  import { Get } from './Get';
2
- export declare const asNumber: (n: unknown, alt?: Get<number, any> | undefined) => number;
2
+ export declare const asNumber: (n: unknown, alt?: Get<number>) => number;
@@ -12,7 +12,7 @@ export declare type PageOptions = {
12
12
  export declare type PageList<T> = List<T> & Omit<PageOptions, 'sort'> & {
13
13
  total?: number;
14
14
  };
15
- export declare const toPageList: <T>(items?: T[] | undefined, options?: (Omit<PageOptions, "sort"> & {
16
- total?: number | undefined;
17
- }) | undefined) => PageList<T>;
15
+ export declare const toPageList: <T>(items?: T[] | undefined, options?: Omit<PageOptions, 'sort'> & {
16
+ total?: number;
17
+ }) => PageList<T>;
18
18
  export declare const asPageList: <T, U>(c: Construct<T>, items?: PageList<U>) => PageList<T>;
@@ -4,5 +4,5 @@ export declare type Result = {
4
4
  location?: string;
5
5
  domain?: string;
6
6
  };
7
- export declare const toResult: (message: Text, location?: Text | undefined, domain?: Text) => Result;
7
+ export declare const toResult: (message: Text, location?: Text, domain?: Text) => Result;
8
8
  export declare const isResult: (r?: unknown) => r is Result;
@@ -4,27 +4,27 @@ import { Get } from './Get';
4
4
  import { Func } from './Func';
5
5
  declare abstract class Try<T = unknown> implements Validatable {
6
6
  is: {
7
- defined: (prop?: Func<unknown, T> | undefined) => Try<T>;
8
- empty: (prop?: Func<unknown, T> | undefined) => Try<T>;
9
- valid: (prop?: Func<unknown, T> | undefined) => Try<T>;
10
- true: (prop?: Func<unknown, T> | undefined) => Try<T>;
11
- false: (prop?: Func<unknown, T> | undefined) => Try<T>;
7
+ defined: (prop?: Func<unknown, T>) => Try<T>;
8
+ empty: (prop?: Func<unknown, T>) => Try<T>;
9
+ valid: (prop?: Func<unknown, T>) => Try<T>;
10
+ true: (prop?: Func<unknown, T>) => Try<T>;
11
+ false: (prop?: Func<unknown, T>) => Try<T>;
12
12
  not: {
13
- defined: (prop?: Func<unknown, T> | undefined) => Try<T>;
14
- empty: (prop?: Func<unknown, T> | undefined) => Try<T>;
15
- valid: (prop?: Func<unknown, T> | undefined) => Try<T>;
13
+ defined: (prop?: Func<unknown, T>) => Try<T>;
14
+ empty: (prop?: Func<unknown, T>) => Try<T>;
15
+ valid: (prop?: Func<unknown, T>) => Try<T>;
16
16
  };
17
17
  };
18
18
  if: {
19
- defined: (prop?: Func<unknown, T> | undefined) => Try<T>;
20
- empty: (prop?: Func<unknown, T> | undefined) => Try<T>;
21
- valid: (prop?: Func<unknown, T> | undefined) => Try<T>;
22
- true: (prop?: Func<unknown, T> | undefined) => Try<T>;
23
- false: (prop?: Func<unknown, T> | undefined) => Try<T>;
19
+ defined: (prop?: Func<unknown, T>) => Try<T>;
20
+ empty: (prop?: Func<unknown, T>) => Try<T>;
21
+ valid: (prop?: Func<unknown, T>) => Try<T>;
22
+ true: (prop?: Func<unknown, T>) => Try<T>;
23
+ false: (prop?: Func<unknown, T>) => Try<T>;
24
24
  not: {
25
- defined: (prop?: Func<unknown, T> | undefined) => Try<T>;
26
- empty: (prop?: Func<unknown, T> | undefined) => Try<T>;
27
- valid: (prop?: Func<unknown, T> | undefined) => Try<T>;
25
+ defined: (prop?: Func<unknown, T>) => Try<T>;
26
+ empty: (prop?: Func<unknown, T>) => Try<T>;
27
+ valid: (prop?: Func<unknown, T>) => Try<T>;
28
28
  };
29
29
  };
30
30
  abstract get value(): T;
@@ -6,9 +6,9 @@ export declare type Segment = Text & {
6
6
  query?: (value: unknown) => string;
7
7
  };
8
8
  export declare const uri: {
9
- host: (key?: string | undefined) => Segment;
9
+ host: (key?: string) => Segment;
10
10
  resource: (resource: Uri) => Segment;
11
- segment: (key?: string | undefined) => Segment;
11
+ segment: (key?: string) => Segment;
12
12
  path: (key: string) => Segment;
13
13
  query: (key: string) => Segment;
14
14
  };
@@ -45,7 +45,7 @@ export declare class EasyUri implements Uri {
45
45
  toString(): string;
46
46
  id: (id?: unknown) => this;
47
47
  query: (q?: unknown) => this;
48
- skip: (index?: number | undefined) => this;
49
- take: (items?: number | undefined) => this;
48
+ skip: (index?: number) => this;
49
+ take: (items?: number) => this;
50
50
  }
51
51
  export {};
@@ -36,7 +36,7 @@ export declare class Mapper extends State implements Mapping {
36
36
  toString(): string;
37
37
  }
38
38
  export declare const mappings: {
39
- item: (property: string, options?: PropertyOptions<unknown> | undefined) => Property;
39
+ item: (property: string, options?: PropertyOptions) => Property;
40
40
  ignore: (property?: string) => Mapping;
41
41
  skipIn: (property: string) => Mapping;
42
42
  skipOut: (property: string) => Mapping;
@@ -27,8 +27,8 @@ export declare const skip: () => undefined;
27
27
  export declare const view: (views: Views) => View;
28
28
  export declare const views: {
29
29
  ignore: () => undefined;
30
- keep: (a: unknown, key?: string | undefined) => unknown;
31
- keepOr: (alt?: string | undefined) => (a: unknown, key?: string | undefined) => unknown;
30
+ keep: (a: unknown, key?: string) => unknown;
31
+ keepOr: (alt?: string) => (a: unknown, key?: string) => unknown;
32
32
  or: (key: string, alt?: string) => (a: unknown) => unknown;
33
33
  value: (value: unknown) => () => unknown;
34
34
  };
@@ -1,19 +1,19 @@
1
1
  import { Func, Results, Text } from '../types';
2
2
  export declare type Constraint = Func<boolean | Results, any>;
3
3
  export declare const constraint: <T>(c: Constraint, message: Text) => PropertyDecorator;
4
- export declare const defined: (message?: Text | undefined) => PropertyDecorator;
5
- export declare const required: (message?: Text | undefined) => PropertyDecorator;
6
- export declare const notEmpty: (message?: Text | undefined) => PropertyDecorator;
4
+ export declare const defined: (message?: Text) => PropertyDecorator;
5
+ export declare const required: (message?: Text) => PropertyDecorator;
6
+ export declare const notEmpty: (message?: Text) => PropertyDecorator;
7
7
  export declare const valid: () => PropertyDecorator;
8
8
  export declare const optional: () => PropertyDecorator;
9
- export declare const includes: (sub: string, message?: string | undefined) => PropertyDecorator;
10
- export declare const inList: (values: unknown[], message?: Text | undefined) => PropertyDecorator;
11
- export declare const gt: (limit: number, message?: Text | undefined) => PropertyDecorator;
12
- export declare const gte: (limit: number, message?: Text | undefined) => PropertyDecorator;
13
- export declare const lt: (limit: number, message?: Text | undefined) => PropertyDecorator;
14
- export declare const lte: (limit: number, message?: Text | undefined) => PropertyDecorator;
15
- export declare const past: (message?: Text | undefined) => PropertyDecorator;
16
- export declare const future: (message?: Text | undefined) => PropertyDecorator;
17
- export declare const minLength: (length: number, message?: Text | undefined) => PropertyDecorator;
18
- export declare const maxLength: (length: number, message?: Text | undefined) => PropertyDecorator;
19
- export declare const rule: (message?: Text | undefined) => PropertyDecorator;
9
+ export declare const includes: (sub: string, message?: string) => PropertyDecorator;
10
+ export declare const inList: (values: unknown[], message?: Text) => PropertyDecorator;
11
+ export declare const gt: (limit: number, message?: Text) => PropertyDecorator;
12
+ export declare const gte: (limit: number, message?: Text) => PropertyDecorator;
13
+ export declare const lt: (limit: number, message?: Text) => PropertyDecorator;
14
+ export declare const lte: (limit: number, message?: Text) => PropertyDecorator;
15
+ export declare const past: (message?: Text) => PropertyDecorator;
16
+ export declare const future: (message?: Text) => PropertyDecorator;
17
+ export declare const minLength: (length: number, message?: Text) => PropertyDecorator;
18
+ export declare const maxLength: (length: number, message?: Text) => PropertyDecorator;
19
+ export declare const rule: (message?: Text) => PropertyDecorator;
@@ -15,7 +15,7 @@ export declare class When<W> {
15
15
  contains: (property: (w: W) => unknown) => When<W>;
16
16
  in: (...items: W[]) => When<W>;
17
17
  is: (item: W) => When<W>;
18
- reject: (error?: Get<ErrorOrigin, W> | undefined) => Promise<NonNullable<W>>;
18
+ reject: (error?: Get<ErrorOrigin, W>) => Promise<NonNullable<W>>;
19
19
  recover: (f: (item: W) => W | Promise<W>) => Promise<W>;
20
20
  protected clone: (result?: boolean) => When<W>;
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thisisagile/easy",
3
- "version": "10.11.14",
3
+ "version": "10.14.0",
4
4
  "description": "Straightforward library for building domain-driven microservice architectures",
5
5
  "author": "Sander Hoogendoorn",
6
6
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "access": "public"
32
32
  },
33
33
  "devDependencies": {
34
- "@thisisagile/easy-test": "10.11.14",
34
+ "@thisisagile/easy-test": "10.14.0",
35
35
  "@types/form-urlencoded": "^4.4.0",
36
36
  "@types/jsonwebtoken": "^8.5.8",
37
37
  "@types/validator": "^13.7.2"
package/src/types/Case.ts CHANGED
@@ -13,7 +13,10 @@ class CaseBuilder<V> {
13
13
 
14
14
  is = {
15
15
  defined: <T>(prop: Func<unknown, V>, out: Func<T, V>): Case<T, V> => new Case<T, V>(this.v).case(isDefined(prop(this.v)), out),
16
- };
16
+ not: {
17
+ defined: <T>(prop: Func<unknown, V>, out: Func<T, V>): Case<T, V> => new Case<T, V>(this.v).case(!isDefined(prop(this.v)), out),
18
+ }
19
+ }
17
20
 
18
21
  if = this.is;
19
22
  }
@@ -39,6 +42,9 @@ class Case<T, V = unknown> {
39
42
 
40
43
  is = {
41
44
  defined: (prop: Func<unknown, V>, out: Func<T, V>): Case<T, V> => new Case<T, V>(this.value).case(isDefined(prop(this.value)), out),
45
+ not: {
46
+ defined: (prop: Func<unknown, V>, out: Func<T, V>): Case<T, V> => new Case<T, V>(this.value).case(!isDefined(prop(this.value)), out),
47
+ }
42
48
  };
43
49
 
44
50
  if = this.is;
@@ -63,6 +69,9 @@ class Found<T, V> extends Case<T, V> {
63
69
 
64
70
  is = {
65
71
  defined: (_prop: Func<unknown, V>, _out: Func<T, V>): Case<T, V> => this,
72
+ not: {
73
+ defined: (_prop: Func<unknown, V>, _out: Func<T, V>): Case<T, V> => this,
74
+ }
66
75
  };
67
76
 
68
77
  if = this.is;