Skip to content

Commit

Permalink
feat(spec): change option type enum member
Browse files Browse the repository at this point in the history
  • Loading branch information
TomokiMiyauci committed Jul 5, 2023
1 parent f474844 commit 5639f50
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@

/** The option type. */
export enum OptionType {
Some = "some",
None = "none",
Some,
None,
}

/** Common type. */
interface Container {
/** Option type. */
type: OptionType;
get type(): OptionType;
}

/** The {@link None} API. */
export interface None extends Container {
type: OptionType.None;
get type(): OptionType.None;
}

/** The {@link Some} API. */
export interface Some<T> extends Container {
type: OptionType.Some;
get type(): OptionType.Some;

/** Return contained {@link T}. */
get get(): T;
Expand All @@ -37,7 +37,9 @@ export const None: None = { type: OptionType.None };
/** {@link Some} constructor. */
export const Some: SomeConstructor = function Some<T>(value: T): Some<T> {
return {
type: OptionType.Some,
get type(): OptionType.Some {
return OptionType.Some;
},
get get(): T {
return value;
},
Expand Down

0 comments on commit 5639f50

Please sign in to comment.