-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import {ResolvedConsequence, Rule} from '../../index'; | ||
import {expectType} from 'tsd'; | ||
|
||
type ExpressionFunction1 = { | ||
user: (user: string, context: { userId: string }) => boolean; | ||
} | ||
|
||
type ExpressionFunction2 = { | ||
user: (user: string, context: { userId: string }) => boolean; | ||
} | ||
|
||
type Context1 = { | ||
timesCounter?: number; | ||
userId: string, | ||
nested: { | ||
value2: number | undefined, | ||
value: number | null, | ||
}, | ||
} | ||
|
||
type Context2 = { | ||
timesCounter?: number; | ||
userId: string, | ||
nested: { | ||
value2: number | undefined, | ||
value: number | null, | ||
}, | ||
} | ||
|
||
type ConsequencePayload1 = { | ||
a: number; | ||
} | ||
|
||
type ConsequencePayload2 = { | ||
a: number; | ||
} | ||
|
||
type RuleFunctionsTable1 = { | ||
rule1: () => void | ResolvedConsequence<ConsequencePayload1> | ||
} | ||
|
||
type RuleFunctionsTable2 = { | ||
rule1: () => void | ResolvedConsequence<ConsequencePayload2> | ||
} | ||
|
||
type Rule1 = Rule<ConsequencePayload1, RuleFunctionsTable1, Context1, ExpressionFunction1, Date>; | ||
type Rule2 = Rule<ConsequencePayload2, RuleFunctionsTable2, Context2, ExpressionFunction2, Date>; | ||
|
||
declare const rule1: Rule1; | ||
declare const rule2: Rule2; | ||
declare const fn: (rule: Rule1) => boolean; | ||
|
||
expectType<boolean>(fn(rule1)); | ||
expectType<boolean>(fn(rule2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters