-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
call Rule.ruleEvent by its correct name #404
call Rule.ruleEvent by its correct name #404
Conversation
@chris-pardy What do you think of this? |
@emilefokkemanavara getting to this finally. What I'd prefer to do is add a property to the rule called event and then we can make this a non-breaking change both on the types and on the implementation. |
@chris-pardy But what I suggested above is already non-breaking, isn't it? |
@chris-pardy I implemented your suggestion. Rule now has both. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I'll merge and deploy this later today.
@@ -175,7 +175,8 @@ export class Rule implements RuleProperties { | |||
constructor(ruleProps: RuleProperties | string); | |||
name: string; | |||
conditions: TopLevelCondition; | |||
event: Event; | |||
ruleEvent: Event; | |||
event: Event |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last thing, we should mark one of these as deprecated.
No reason to remove it until a v8 but we should be starting that process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we'll deprecate ruleEvent
, right? (Because we want a Rule
to still implement RuleOptions
RuleProperties
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct.
@emilefokkemanavara to add a note here on the reason your original change would have still been a breaking change. There's effectively 2 artifacts being distributed as part of this library - types and code. Because of the nature of Typescript there's no restriction on how the types are used. For instance say I have something like: type RuleThings = Partial<Record<keyof Rule, string>>;
const ruleThings: RuleThings = {
'event': 'test'
} When we dropped the event property it would have broken this code. Making the change the way we did we |
Currently, the types suggest that
Rule
has a property calledevent
, but the property is actually calledruleEvent
, as evidenced by this test. This PR fixes that by changing the type ofRule
. This is not breaking because any TypeScript code referring to aRule
'sevent
can never have worked.