Skip to content

Commit

Permalink
fix(interface): Type -> TypeName and Field -> FieldName
Browse files Browse the repository at this point in the history
  • Loading branch information
Sytten committed Jun 17, 2020
1 parent 1cade79 commit d2beda0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/builders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,18 @@ export const deny = new RuleFalse();
*
*/
export const generic = (rule: ShieldRule<any, any>) => <
Type extends string,
Field extends string
>(): ShieldRule<Type, Field> => rule;
TypeName extends string,
FieldName extends string
>(): ShieldRule<TypeName, FieldName> => rule;

/**
*
* Helper for partial rules
*
*/
export const partial = <Type extends string>(rule: ShieldRule<Type, any>) => <
T extends Type, // NOTE: It would be best to do someting with this type
Field extends string
>(): ShieldRule<Type, Field> => rule;
export const partial = <TypeName extends string>(
rule: ShieldRule<TypeName, any>
) => <
T extends TypeName, // NOTE: It would be best to do something with this type
FieldName extends string
>(): ShieldRule<TypeName, FieldName> => rule;

0 comments on commit d2beda0

Please sign in to comment.