Skip to content

Commit

Permalink
Remove cast
Browse files Browse the repository at this point in the history
  • Loading branch information
bloodyowl committed Aug 7, 2023
1 parent a046974 commit 6aebbe2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/AsyncData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,9 @@ export const AsyncData = {
},

isAsyncData: (value: unknown): value is AsyncData<unknown> =>
Object.prototype.isPrototypeOf.call(doneProto, value as Object) ||
Object.prototype.isPrototypeOf.call(asyncDataProto, value as Object),
value != null &&
(Object.prototype.isPrototypeOf.call(doneProto, value) ||
Object.prototype.isPrototypeOf.call(asyncDataProto, value)),

P: asyncDataPattern,
pattern: asyncDataPattern,
Expand Down
2 changes: 1 addition & 1 deletion src/Future.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class Future<A> {
};

static isFuture = (value: unknown): value is Future<unknown> =>
Object.prototype.isPrototypeOf.call(futureProto, value as Object);
value != null && Object.prototype.isPrototypeOf.call(futureProto, value);

/**
* Creates a future resolved to the passed value
Expand Down
10 changes: 6 additions & 4 deletions src/OptionResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ export const Option = {
None,

isOption: (value: unknown): value is Option<unknown> =>
Object.prototype.isPrototypeOf.call(optionProto, value as Object) ||
Object.prototype.isPrototypeOf.call(someProto, value as Object),
value != null &&
(Object.prototype.isPrototypeOf.call(optionProto, value) ||
Object.prototype.isPrototypeOf.call(someProto, value)),

/**
* Create an Option from a nullable value
Expand Down Expand Up @@ -481,8 +482,9 @@ export const Result = {
Error,

isResult: (value: unknown): value is Result<unknown, unknown> =>
Object.prototype.isPrototypeOf.call(okProto, value as Object) ||
Object.prototype.isPrototypeOf.call(errorProto, value as Object),
value != null &&
(Object.prototype.isPrototypeOf.call(okProto, value) ||
Object.prototype.isPrototypeOf.call(errorProto, value)),

/**
* Runs the function and resolves a result of its return value, or to an error if thrown
Expand Down

0 comments on commit 6aebbe2

Please sign in to comment.