Skip to content

Simplify Type Exports #89

@Hrdtr

Description

@Hrdtr

Describe the feature

// v1.x — separate "Any" types
type GuantrAnyRule = { resource: string; action: string; condition: ... };
type GuantrRule<Meta, Context, ResourceKey> = /* typed version */;
type GuantrAnyRuleCondition = { [key: string]: ... };
type GuantrAnyRuleConditionExpression = [...];

// v2.0 — unified types, untyped when no generics provided
type GuantrRule = { resource: string; action: string; condition?: ... };
type GuantrRule<Meta, Context, ResourceKey> = /* typed version when Meta provided */;
type GuantrRuleCondition = { [key: string]: ... };
type GuantrRuleCondition<Model, Context> = /* typed version when Model provided */;
type GuantrRuleConditionExpression = [...];

Rationale

GuantrAnyRule / GuantrAnyRuleCondition are just GuantrRule / GuantrRuleCondition
without type arguments. Having separate names is confusing and redundant.

Migration

  • GuantrAnyRuleGuantrRule (no type args)
  • GuantrAnyRuleConditionGuantrRuleCondition (no type args)
  • GuantrAnyRuleConditionExpressionGuantrRuleConditionExpression (no type args)

Implementation Tasks

  • Make GuantrRule default to untyped when no Meta is provided
  • Make GuantrRuleCondition default to untyped when no Model is provided
  • Remove GuantrAnyRule, GuantrAnyRuleCondition, GuantrAnyRuleConditionExpression
  • Update all internal code and Storage interface
  • Update all documentation

Additional information

  • Would you be willing to help implement this feature?
  • Can you think of other implementations of this feature?

Final checks

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions