Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

TypeScript #28

Merged
merged 50 commits into from
Jan 12, 2021
Merged

TypeScript #28

merged 50 commits into from
Jan 12, 2021

Conversation

aminya
Copy link
Contributor

@aminya aminya commented Mar 14, 2020

Ready to get merged - Tested and is working

Description of the Change - Release Notes

  • Converting codebase source to typescript while being completely backward-compatible
  • Adding type definitions + documentation for API
  • Optimizing the code wherever possible

Verification Process

  • I verify the changes against other packages that use atom-select-list: for example, atom-indent-detective uses atom-select-list.
  • The tests are untouched to show backward compatibility

Possible Drawbacks

  • Nothing (backward compatible - zero change in the API and JavaScript code)

Alternate Designs

  • using @types/atom-select-list. But this doesn't allow us to use the power of typescript for optimizing and catching the bugs.

@aminya aminya force-pushed the TypeScript branch 8 times, most recently from 2d87e5f to c9d5a9b Compare March 29, 2020 15:47
@aminya aminya marked this pull request as ready for review March 29, 2020 15:48
@aminya
Copy link
Contributor Author

aminya commented Mar 29, 2020

@maxbrunsfeld Could you review this?

@aminya aminya force-pushed the TypeScript branch 2 times, most recently from 0e78c95 to 5dd7136 Compare April 11, 2020 10:02
@aminya
Copy link
Contributor Author

aminya commented Apr 11, 2020

Is there anyone to check this?

@nshikov @maxbrunsfeld @t9md @50Wliu

@aminya aminya force-pushed the TypeScript branch 3 times, most recently from be16a04 to bda0c3d Compare April 11, 2020 10:19
@aminya
Copy link
Contributor Author

aminya commented Jan 5, 2021

Disclaimer: I'm no longer an Atom maintainer and my knowledge of the ecosystem is now 1.5 years old.
That said, still happy to give reviews that pop up on my notifications feed when I have the time.

Glad to hear from you!

This looks like a fairly straightforward port to Typescript. Have the current maintainers indicated that they're open to switching to Typescript? (I think there were some conversations about this...too fuzzy for me to recall for sure though)

There are only 2-3 people officially working part-time on Atom. They rarely get time to address the PRs. We are considering forking the whole organization in @atom-community, so I am not surprised anymore that I did not get any response here.

Most of my comments are related to the configuration of Typescript itself, plus a few questions about the TODO comments you left.

I addressed most of them. I left some comments for the unresolved ones.

Copy link
Contributor

@winstliu winstliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor stuff, but still a few questions

src/select-list-view.ts Show resolved Hide resolved
src/select-list-view.ts Outdated Show resolved Hide resolved
tsconfig.json Outdated Show resolved Hide resolved
props: SelectListProperties

/** an array containing the objects you want to show in the select list. */
items: Array<object | string> // TODO: Added initializer! Either fix this.items or assign it in constructor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked through the code to re-familiarize myself with this. It technically is assigned in the constructor, via computeItems. Does Typescript throw an error if it's not explicitly set in the constructor itself? I forget how good it is at following the codeflow.

I'm not positive, but I think it is necessary because of the slices we do on it; this way this.props.items is the original copy and this.items is the filtered & ordered list that's shown.

src/select-list-view.ts Outdated Show resolved Hide resolved
src/select-list-view.ts Outdated Show resolved Hide resolved
src/select-list-properties.ts Outdated Show resolved Hide resolved
props: SelectListProperties

/** an array containing the objects you want to show in the select list. */
items: Array<object | string> // TODO: Added initializer! Either fix this.items or assign it in constructor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And: is this meant to be public?

@aminya
Copy link
Contributor Author

aminya commented Jan 6, 2021

I looked through the code to re-familiarize myself with this. It technically is assigned in the constructor, via computeItems. Does Typescript throw an error if it's not explicitly set in the constructor itself? I forget how good it is at following the codeflow.

I'm not positive, but I think it is necessary because of the slices we do on it; this way this.props.items is the original copy and this.items is the filtered & ordered list that's shown.

And: is this meant to be public?

Yes, that seems like it. I will change it to private because it is not documented.

Copy link
Contributor

@winstliu winstliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buncha small stuff. Only thing I'm blocking over is the last TODO comment.

(p.s. you'll do reviewers a favor if you elaborate more on what you mean by your TODOs in the future 🙂)

src/select-list-view.ts Outdated Show resolved Hide resolved
src/select-list-view.ts Outdated Show resolved Hide resolved
src/select-list-view.ts Outdated Show resolved Hide resolved
src/select-list-view.ts Outdated Show resolved Hide resolved
src/select-list-view.ts Show resolved Hide resolved
aminya and others added 2 commits January 6, 2021 18:14
@aminya
Copy link
Contributor Author

aminya commented Jan 7, 2021

Per atom/etch@18512fc/lib/patch.js#L46, it looks like {} is the default value that's passed in if there's no new props. Which says two things:

The = {} shouldn't even be needed b/c we should never be passed an undefined value, per the source above
Since it's intentional that we can be passed an empty object, I think it's fine that we just handle that normally.
So I don't think this TODO needs to stay.

Which one should I remove? = {} or the TODO?

@winstliu
Copy link
Contributor

winstliu commented Jan 7, 2021

Both :)

Copy link
Contributor

@winstliu winstliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy with this 👍.

src/select-list-view.ts Outdated Show resolved Hide resolved
Co-authored-by: Winston Liu <Wliu1402@gmail.com>
@aminya
Copy link
Contributor Author

aminya commented Jan 9, 2021

@50Wliu Could you merge this if you have access? I don't want to wait another year for merging 😞

@winstliu
Copy link
Contributor

Sorry, I don't merge things anymore :/.
@sadick254 is this something in your area?

@sadick254 sadick254 merged commit 4952038 into atom:master Jan 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants