-
Notifications
You must be signed in to change notification settings - Fork 635
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
feat: create createBackingVariable method #2106
feat: create createBackingVariable method #2106
Conversation
Created a protected method that creates the variable for observable_parameter_model to make the class easier to subclass
@shivalipatel6 I think this looks great! Can you call the protected function from the constructor? I think if you do that it's no longer a breaking change. |
This will change my last commit from a breaking change to a non-breaking change.
ran npm ci and npm run format to find my formatting errors and fix them
* @returns This parameter model. | ||
*/ | ||
|
||
protected createBackingVariable(name: string, varId?: string): this { |
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.
Sorry I should have asked for this change in my last review :/
Could you actually change this to return the new variable instead of assigning it? Then you can assign it in the constructor. That way all of the side effects are localized to the constructor, and people overriding this function don't have to remember to do the side effect!
Then this should be good to go =)
changed the return type of createBackingVariable so that it returns the variable itself.
ran npm ci and npm run format to address formatting errors in the pr
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.
Two nits then should be good to go!
plugins/block-shareable-procedures/src/observable_parameter_model.ts
Outdated
Show resolved
Hide resolved
plugins/block-shareable-procedures/src/observable_parameter_model.ts
Outdated
Show resolved
Hide resolved
This looks great! Thank you so much @shivalipatel6 =) |
Created a protected method that creates the variable for observable_parameter_model to make the class easier to subclass
The basics
The details
Resolves
Fixes #1861
Proposed Changes
Creates a new method in the ObservableParameterModel class that will be used to create new variables instead of using the constructor.
Reason for Changes
Makes the class easier to subclass when a developer wants to create a typed variable.
Test Coverage
I ran the test class in the block-shareable-procedure files and it ran.

Documentation
Additional Information