refactor(database): Add types to several classes and utility methods - #66
Conversation
There was a problem hiding this comment.
This condition would never be true since it's comparing a number with a string. It was probably meant to say
if (c + segsize > str.length) {
This has probably gone undetected for a while since it didn't cause any problems anyway. According to MDN for substring: If either argument is greater than stringName.length, it is treated as if it were stringName.length.
We might as well remove the condition altogether?
There was a problem hiding this comment.
There was something weird here between the module-wide logger variable and the parameter passed to the enableLogging() function.
Edit: I just checked the original JS code and the module-wide variable was fb.core.util.logger, so that explains it. Make sure to review these changes with special care anyway.
There was a problem hiding this comment.
Great catch on this. This is, as you pointed out, a bug from migration.
There was a problem hiding this comment.
startEndSet_ doesn't exists in this class. I'm 99.9% sure this was meant to say endNameSet_, but double-check just in case.
Edit: the same mistake is present in the current JS code. It's probably a good idea to check whether fixing this might somehow introduce a breaking change, in case other parts of the code are unknowingly relying on the current behavior.
Edit 2: nah, it's safe to make this change. The way it currently works, calling QueryParams#endAt() would fail to set endNameSet_ to false when called without a key name, but it was already initialized as false anyway. Subsequent calls to endAt() are not allowed by Query, so it never changes after that.
60a103f to
f86c8e9
Compare
|
I'm going to try and dig into this in the next couple of days. I want to get the test harness in a place where it is available first. Initial look is good though! |
|
Sure @jshcrowthe, no hurry! I was taking a look at the new tests and I realized it will be necessary to make a few changes to some of them if this PR is merged, specially when using classes like SortedMap, LLRBNode, ImmutableTree, etc, since I added generic types. Let me know when that PR is merged and I'll update this one with any necessary changes, ok? |
7efa1b0 to
2f6a406
Compare
d0c40aa to
7eb6213
Compare
There was a problem hiding this comment.
I removed this clearTimeout since this.onClose is a function. Probably left over from a previous change.
|
I had to force-push some changes to the first commit. If you already pulled it earlier then make sure to pull the latest version. |
7eb6213 to
e975c0c
Compare
jshcrowthe
left a comment
There was a problem hiding this comment.
I have gone through this and it all looks pretty good. There are some stylistic differences here but I plan on hitting the whole project with the prettier hammer here after this PR is merged so I'm going to ignore that for now.
There was a problem hiding this comment.
I noticed there is a couple places in this file where we do the <T> casting. We currently aren't using TSX but if we wanted to we would probably need to migrate these to do as casting.
This is true for all instances of this
|
The test harness fails on this with a slew of errors. Please point this to |
|
Yeah, that's probably because of the generic types that I mentioned. I'll look into it. |
|
If I point this PR to the Should I do it anyway and then rebase later when that PR is merged? |
b128848 to
3b95509
Compare
|
Just for reference, this is the result of my build and these numbers are after minification:
So clearly something's amiss. Besides that, I just merged my changes into the I think you're right, I probably messed up a merge at some point. I'll see if I can sort this out tomorrow, thanks for the patience :) |
8406db5 to
d9fea62
Compare
|
Ok, I've solved all the merge issues. Sorry for all the noise about this. There's a handful of tests failing but I'll look into that tomorrow. |
d9fea62 to
322c54a
Compare
|
Only 2 tests are failing on my end:
|
|
@jsayol perfect, as part of the review for #71 we are adding a global timeout of In addition, it seems I forgot to skip the test in the Node test setup. I have skipped the test and pushed it to |
|
Hey @jsayol we have gotten all of the PR's merged, if you'll please rebase we can get this merged. |
|
I have pointed this PR to the master branch as we have merged #72 |
Sure, I'll try to get around to it this weekend. |
a92520a to
4d30da1
Compare
* refactor(database): Several classes and utility methods * WIP: fix tests with recent type changes * refactor(database): Type casting format for TSX support * refactor(database): Add 'noImplicitAny' support Adds support for the 'noImplicitAny' Typescript compiler option to the database implementation.
4d30da1 to
eca9bdd
Compare
|
@jshcrowthe done. |
There was a problem hiding this comment.
Great catch on this. This is, as you pointed out, a bug from migration.
|
I have run tests locally and they all pass, Travis-CI seems to have hung, so I am going to merge this. |
Refactoring of several classes and utility methods to add proper types and annotations