Skip to content

Commit

Permalink
feat: make RustlikeResult a bit smaller
Browse files Browse the repository at this point in the history
  • Loading branch information
yifanwww committed Jun 2, 2024
1 parent b09491c commit 842e55b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Result.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ export class RustlikeResult<T, E> implements Result<T, E> {
constructor(type: 'ok', value: T);
constructor(type: 'err', error: E);
constructor(type: ResultType, value: T | E) {
this._type = type;
if (type === 'ok') {
this._type = 'ok';
this._value = value as T;
} else {
this._type = 'err';
this._error = value as E;
}
}
Expand Down

0 comments on commit 842e55b

Please sign in to comment.