Skip to content

Commit

Permalink
#88: better typescript support for opt() and then()
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-zozol committed May 6, 2019
1 parent 5a049bf commit 808c6b1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion masala-parser.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,18 @@ export interface VoidParser extends SingleParser<MASALA_VOID_TYPE> {
* ```
* @param p next parser
*/
then<Y>(p: IParser<Y>): TupleParser<Y>;
then(p: VoidParser): TupleParser<MASALA_VOID_TYPE>;
then<Y>(p: TupleParser<Y>): TupleParser<Y>;
then<Y>(p: SingleParser<Y>): SingleParser<Y>;
then<Y>(p: IParser<Y>): TupleParser<Y>;

thenEos():TupleParser<MASALA_VOID_TYPE>;

or(other: VoidParser): VoidParser;
or<T, P extends IParser<T>>(other: P): VoidParser|P;


opt(): SingleParser<Option<MASALA_VOID_TYPE>>;
}

export interface SingleParser<T> extends IParser<T> {
Expand All @@ -443,6 +447,9 @@ export interface SingleParser<T> extends IParser<T> {
or(other: SingleParser<T>): SingleParser<T>;
or<Y>(other: SingleParser<Y>): SingleParser<T|Y>;
or<Y, P extends IParser<Y>>(other: P): SingleParser<T>|P;


opt(): SingleParser<Option<T>>
}


Expand Down

0 comments on commit 808c6b1

Please sign in to comment.