-
Notifications
You must be signed in to change notification settings - Fork 7
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
Type annotations #41
Type annotations #41
Conversation
Pull Request Test Coverage Report for Build 9372440637Details
💛 - Coveralls |
|
…-viz into type-annotations
Pull Request Test Coverage Report for Build 9389923649Details
💛 - Coveralls |
Proposed ChangesAdded type interfaces and type annotations for functions and constants in Type of Change(Write an
Checklist(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the Before opening your pull request:
After opening your pull request:
Questions and Comments(Include any questions or comments you have regarding your changes.) |
Pull Request Test Coverage Report for Build 9390090716Details
💛 - Coveralls |
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.
@yoonieaj great work. I left a few inline comments. Also:
- I see that you left a comment with your full PR description. Instead, you can edit your existing PR description and then copy back in the contents of that comment.
- Since you've defined the
DrawnObject
type very well, please go ahead and modify the other source code files to use this type annotation instead of the old "object" type. You don't need to add type annotations to all functions/values in those other files though, just make sure to useDrawnObject
where appropriate.
memory-viz/src/automate.ts
Outdated
@@ -73,7 +73,7 @@ function drawAutomatedStackFrames(stack_frames, configuration) { | |||
let width; | |||
let height; | |||
|
|||
if (stack_frame.name !== "BLANK") { | |||
if (stack_frame.type !== "BLANK") { |
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.
This change is out of scope of this PR (and in fact I suspect it's related to what @sarahsonder is working on currently).
memory-viz/src/types.ts
Outdated
@@ -0,0 +1,25 @@ | |||
interface DrawnObject { |
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.
Use the export
keyword for these types, and then import them explicitly in style.ts
.
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.
Also rename this type to DrawnEntity
, since the word "object" has another meaning in the context of memory model diagrams.
…nto type-annotations
Pull Request Test Coverage Report for Build 9457996657Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9458015375Details
💛 - Coveralls |
memory-viz/src/types.ts
Outdated
value: any; | ||
show_indexes?: boolean; | ||
style?: Style; | ||
height: number; |
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.
I think this, width
, and rowBreaker
are also optional?
memory-viz/src/automate.ts
Outdated
@@ -244,7 +245,7 @@ function drawAutomatedOtherItems( | |||
* The returned object has two attributes as 'stack_frames' and 'other_items'. | |||
* Each of these attributes are a list of objects that were originally given by the user. | |||
* | |||
* @param {object[]} objects - The list of objects, including stack-frames (if any) and other items, that | |||
* @param {Object[]} objects - The list of objects, including stack-frames (if any) and other items, that |
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.
Is this meant to be DrawnEntity
?
Pull Request Test Coverage Report for Build 9474095102Details
💛 - Coveralls |
Proposed Changes
Added type interfaces and type annotations for functions and constants in
style.ts
. This should improve code organisation/readability....
Type of Change
(Write an
X
or a brief description next to the type or types that best describe your changes.)Checklist
(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the
[ ]
into a[x]
in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)Before opening your pull request:
After opening your pull request:
Questions and Comments
Hello Professor Liu! I have a few questions about the changes I've made so far: