14:49 PM
CatQuest
2021-08-04 21634, 2021
14:50 PM
reosarevok
Oh, that's kind of neat
2021-08-04 21627, 2021
14:51 PM
CatQuest
ikr?
2021-08-04 21642, 2021
14:51 PM
yyoung
reosarevok: Maybe annotate irrelevantLinkTypes with type definition?
2021-08-04 21611, 2021
14:52 PM
yyoung fought againt flowtype last night and gained some experience.
2021-08-04 21624, 2021
14:52 PM
bitmap
reosarevok: you can assign irrelevantLinkTypes[targetType] to a var and check that instead
2021-08-04 21610, 2021
14:53 PM
reosarevok
bitmap: I originally had this but had the same error:
2021-08-04 21612, 2021
14:53 PM
reosarevok
2021-08-04 21628, 2021
14:53 PM
yyoung
bitmap: Also is there any workaround for Object.entries, Object.values etc?
2021-08-04 21628, 2021
14:53 PM
reosarevok
It doesn't like that I'm trying to do irrelevantLinkTypes[targetType] in the first place
2021-08-04 21658, 2021
14:53 PM
bitmap
reosarevok: what's the error?
2021-08-04 21613, 2021
14:54 PM
reosarevok
2021-08-04 21618, 2021
14:54 PM
reosarevok
Same for the rest of the CoreEntityTs
2021-08-04 21638, 2021
14:54 PM
reosarevok
I mean, I could just add empty maps for the other entity types, of course, but
2021-08-04 21642, 2021
14:54 PM
bitmap
oh right
2021-08-04 21650, 2021
14:54 PM
bitmap
I'd just add a $FlowIgnore
2021-08-04 21609, 2021
14:55 PM
bitmap
it's not wrong, but we know it's irrelevant
2021-08-04 21618, 2021
14:56 PM
reosarevok
ok
2021-08-04 21639, 2021
14:56 PM
bitmap
yyoung: usually I just use a type cast and add // $FlowIssue[foo] comment
2021-08-04 21605, 2021
14:57 PM
bitmap
alternatively if it's used as a map you can just use a Map, which is easier to type
2021-08-04 21626, 2021
14:57 PM
reosarevok
So it should be ok to leave const irrelevantTypesForTargetType = irrelevantLinkTypes[targetType]; and just add the FlowIssue? :)
2021-08-04 21627, 2021
14:57 PM
bitmap
2021-08-04 21608, 2021
14:58 PM
bitmap
reosarevok: yup
2021-08-04 21604, 2021
14:59 PM
reosarevok
Thanks! :)
2021-08-04 21643, 2021
14:59 PM
reosarevok
bitmap: also, did you see my question about MBS-11844?
2021-08-04 21644, 2021
14:59 PM
BrainzBot
2021-08-04 21650, 2021
14:59 PM
bitmap
was just looking
2021-08-04 21647, 2021
15:00 PM
bitmap
iiuc this is actually something I fixed in the new rel editor, so I don't think it was entirely intentional
2021-08-04 21606, 2021
15:01 PM
bitmap
what did you mean by "so that this doesn't happen if there's more than two relationships with the same attributes above the button"?
2021-08-04 21645, 2021
15:03 PM
ruaok
2021-08-04 21646, 2021
15:05 PM
reosarevok
this doesn't happen - the reusing of the attributes
2021-08-04 21659, 2021
15:05 PM
reosarevok
But maybe it was a bug all along, in which case goddamnit, why didn't I fix it like a few years ago
2021-08-04 21611, 2021
15:08 PM
MRiddickW joined the channel
2021-08-04 21635, 2021
15:10 PM
yyoung
2021-08-04 21643, 2021
15:10 PM
bitmap
oh nvm I was reading it as 'it was intentional because x'
2021-08-04 21619, 2021
15:12 PM
reosarevok
yyoung: we can have relationships to all types, so I would not be able to restrict the target type like this I don't think :)
2021-08-04 21632, 2021
15:12 PM
reosarevok
But the flowignore works
2021-08-04 21626, 2021
15:13 PM
bitmap
well I guess his point is that adding a {[foo]: ...} (indexer) annotation allows you to access any key, which is true
2021-08-04 21644, 2021
15:13 PM
yyoung
Exactly.
2021-08-04 21647, 2021
15:13 PM
bitmap
without the annotation flow sees it as a record with specific keys
2021-08-04 21653, 2021
15:14 PM
reosarevok
Oh, I see.
2021-08-04 21614, 2021
15:15 PM
reosarevok
Well, that seems to work, so why not
2021-08-04 21640, 2021
15:15 PM
reosarevok
Was confused by the type CoreEntityTypeT = 'work' | 'recording' | 'url' | 'artist' but i guess that was just for the flowtry, lol
2021-08-04 21653, 2021
15:15 PM
yyoung
Yes :D
2021-08-04 21600, 2021
15:16 PM
reosarevok
Thanks!
2021-08-04 21641, 2021
15:17 PM
reosarevok
bitmap: are you available to look at a bit more of the guess case mess? :)
2021-08-04 21601, 2021
15:18 PM
bitmap
yup
2021-08-04 21618, 2021
15:18 PM
reosarevok
So, I did Output, seems to work fine
2021-08-04 21622, 2021
15:18 PM
bitmap was looking at old rel editor code 'cause I could've sworn it used to use the attributes
2021-08-04 21631, 2021
15:18 PM
reosarevok
(that also had some methods which we weren't using, etc)
2021-08-04 21645, 2021
15:18 PM
reosarevok
Oh, by all means also continue to do that when I stop bothering you :D That's an annoying one
2021-08-04 21630, 2021
15:19 PM
bitmap
(it is fixed in the new code at least)
2021-08-04 21619, 2021
15:21 PM
bitmap
are Flow types passing on that branch?
2021-08-04 21621, 2021
15:21 PM
reosarevok
When are we releasing the new code? :)
2021-08-04 21646, 2021
15:21 PM
bitmap
when it's done :D
2021-08-04 21611, 2021
15:22 PM
reosarevok
The guess-case-refactoring branch?
2021-08-04 21614, 2021
15:22 PM
reosarevok
Currently yes
2021-08-04 21621, 2021
15:22 PM
bitmap
cool
2021-08-04 21632, 2021
15:22 PM
reosarevok
But I want to get rid of declare type GuessCaseModeT = any;
2021-08-04 21655, 2021
15:22 PM
bitmap
declare type GuessCaseOutputT = GuessCaseOutput; <- probably isn't particularly useful anymore
2021-08-04 21631, 2021
15:24 PM
reosarevok
Oh. Fair point.
2021-08-04 21629, 2021
15:25 PM
reosarevok
But yeah, so
2021-08-04 21630, 2021
15:25 PM
reosarevok
root/static/scripts/guess-case/modes.js
2021-08-04 21655, 2021
15:25 PM
reosarevok
I guess rather than object assign DefaultMode and whatnot, here we should have a class DefaultMode and other classes that extend it, right?
2021-08-04 21635, 2021
15:26 PM
bitmap
hmm, well
2021-08-04 21649, 2021
15:27 PM
bitmap
I think we can just leave them as objects since we don't need need/use multiple instances
2021-08-04 21618, 2021
15:28 PM
bitmap
in fact Output/Input don't either but they were already written like classes so it was easier to convert them that way
2021-08-04 21613, 2021
15:29 PM
reosarevok
I'm just not sure how to even type these so that we can actually use them for flow types :D
2021-08-04 21633, 2021
15:29 PM
bitmap
I'd just define a GuessCaseModeT object type based on DefaultMode
2021-08-04 21644, 2021
15:30 PM
bitmap
and change these `Object.assign({}, DefaultMode, {...})` to `{...DefaultMode, ...}`, Flow has less issues with spreads now
2021-08-04 21646, 2021
15:34 PM
bitmap
as long as they don't add any new properties/methods they should all just be exportable as GuessCaseModeT?
2021-08-04 21659, 2021
15:34 PM
Etua joined the channel
2021-08-04 21603, 2021
15:35 PM
reosarevok
Ok, let's see
2021-08-04 21638, 2021
15:36 PM
bitmap
English adds fixEnglishKeyNames but we could probably merge that into runPostProcess since it's only called from there
2021-08-04 21648, 2021
15:37 PM
bitmap
we'll have to do that anyway since Flow no longer lets you use 'this' inside object methods
2021-08-04 21613, 2021
15:38 PM
reosarevok
Ok, I'll do that
2021-08-04 21652, 2021
15:46 PM
CatQuest
ruaok: lol
2021-08-04 21624, 2021
15:47 PM
CatQuest votes for that being rob's new icon
2021-08-04 21600, 2021
16:01 PM
reosarevok
2021-08-04 21617, 2021
16:01 PM
reosarevok
That's just "string", right?
2021-08-04 21644, 2021
16:01 PM
reosarevok
But how do I indicate the type?
2021-08-04 21643, 2021
16:02 PM
bitmap
string, yea
2021-08-04 21644, 2021
16:07 PM
reosarevok
Yeah, but how did we indicate it exactly?
2021-08-04 21635, 2021
16:10 PM
reosarevok
Also, sigh
2021-08-04 21637, 2021
16:10 PM
reosarevok
2021-08-04 21658, 2021
16:10 PM
reosarevok
2021-08-04 21609, 2021
16:11 PM
reosarevok
Flow, we literally checked it's not null 😢
2021-08-04 21601, 2021
16:12 PM
reosarevok
to be fair, I'm sure this can be written in a nicer way
2021-08-04 21603, 2021
16:12 PM
reosarevok
2021-08-04 21608, 2021
16:12 PM
reosarevok
bitmap: help appreciated :)
2021-08-04 21656, 2021
16:12 PM
bitmap
+description: string,?
2021-08-04 21641, 2021
16:13 PM
reosarevok
Oh. Oh. Duh.
2021-08-04 21601, 2021
16:14 PM
reosarevok
I'm typing the functions inside the object, such as
2021-08-04 21604, 2021
16:14 PM
reosarevok
2021-08-04 21642, 2021
16:14 PM
reosarevok
So I guess I was expecting a similar way for the description
2021-08-04 21607, 2021
16:15 PM
reosarevok
I guess maybe I need to do that as a separate type, but then does that also require typing the functions there instead?
2021-08-04 21608, 2021
16:15 PM
bitmap
I guess for the matches thing you can do the assignment inside an else-branch
2021-08-04 21631, 2021
16:15 PM
Etua has quit
2021-08-04 21649, 2021
16:15 PM
reosarevok
Oh, just like
2021-08-04 21651, 2021
16:15 PM
reosarevok
2021-08-04 21600, 2021
16:16 PM
bitmap
yup
2021-08-04 21603, 2021
16:16 PM
reosarevok
Sure, that works, I had thought of that but I was wondering about the while above
2021-08-04 21618, 2021
16:16 PM
reosarevok
Like, flow is happy with that one, but wondering if there's a better way or we should leave it be :)
2021-08-04 21636, 2021
16:16 PM
bitmap
it seems alright if Flow is ok with it
2021-08-04 21640, 2021
16:16 PM
reosarevok
Ok
2021-08-04 21624, 2021
16:17 PM
reosarevok
Oh, it says
2021-08-04 21626, 2021
16:17 PM
reosarevok
2021-08-04 21651, 2021
16:17 PM
bitmap
hmm yeah, I was thinking of defining the type separately so that you can do French: GuessCaseModeT =
2021-08-04 21603, 2021
16:18 PM
bitmap
otherwise it'll have those issues
2021-08-04 21606, 2021
16:18 PM
reosarevok
I guess we could
2021-08-04 21611, 2021
16:18 PM
reosarevok
So for the functions, that'd be, say
2021-08-04 21621, 2021
16:18 PM
Etua joined the channel
2021-08-04 21627, 2021
16:18 PM
reosarevok
isLowerCaseWord: (string) => boolean?
2021-08-04 21636, 2021
16:18 PM
bitmap
yeah
2021-08-04 21609, 2021
16:25 PM
reosarevok
So
2021-08-04 21611, 2021
16:25 PM
reosarevok
2021-08-04 21624, 2021
16:25 PM
reosarevok
(dunno if all of those should be +?)
2021-08-04 21629, 2021
16:25 PM
reosarevok
Same for all of
2021-08-04 21631, 2021
16:25 PM
reosarevok
2021-08-04 21633, 2021
16:25 PM
reosarevok
for that matter
2021-08-04 21644, 2021
16:29 PM
bitmap
yea I'd make them + unless we intend to overwrite the properties
2021-08-04 21628, 2021
16:30 PM
bitmap
like CFG_KEEP_UPPERCASED should probably stay writable
2021-08-04 21609, 2021
16:38 PM
reosarevok
bitmap: what do you think about root/static/scripts/guess-case/MB/GuessCase/Main.js?
2021-08-04 21620, 2021
16:38 PM
reosarevok
Seems like another thing that wants to be a class
2021-08-04 21647, 2021
16:40 PM
reosarevok
At the same time, that's just the current GuessCaseT, so maybe it should be an object? I dunno
2021-08-04 21630, 2021
16:41 PM
bitmap
true, let's just keep it as an object
2021-08-04 21634, 2021
16:42 PM
bitmap
not sure where to put all these entity handlers though
2021-08-04 21653, 2021
16:43 PM
peterhil has quit
2021-08-04 21620, 2021
16:44 PM
bitmap
we do stuff like (MB.GuessCase: any)[entityType].sortname so I suppose they should stay in an object like that, just not MB.GuessCase
2021-08-04 21635, 2021
16:48 PM
reosarevok
Hmm. Can it be an object though?
2021-08-04 21645, 2021
16:48 PM
reosarevok
2021-08-04 21653, 2021
16:48 PM
reosarevok
Can an object do anything like that self. thing?
2021-08-04 21659, 2021
16:48 PM
reosarevok
You said flow blocks this.
2021-08-04 21619, 2021
16:49 PM
reosarevok
I guess I could just do modes[getCookie('guesscase_mode') || 'English']
2021-08-04 21618, 2021
16:51 PM
bitmap
right, or you can assign modeName to a var first
2021-08-04 21628, 2021
16:51 PM
peterhil joined the channel
2021-08-04 21601, 2021
16:52 PM
reosarevok
Oh, I guess
2021-08-04 21636, 2021
16:52 PM
bitmap
the thing about Flow blocking 'this' inside methods? this is neither a method nor using 'this'
2021-08-04 21609, 2021
16:53 PM
reosarevok
Hmm
2021-08-04 21616, 2021
16:53 PM
reosarevok
What about input = new Input(self)?
2021-08-04 21626, 2021
16:53 PM
reosarevok
Also do it from the outside?
2021-08-04 21639, 2021
16:54 PM
bitmap
oh, circular references. annoying
2021-08-04 21601, 2021
16:55 PM
bitmap
is that even possible, since self == GuessCase, right?
2021-08-04 21629, 2021
16:55 PM
reosarevok
Yes
2021-08-04 21659, 2021
16:55 PM
reosarevok
Well, self, by that time, was an empty object to which modeName, mode and CFG_KEEP_UPPERCASED had been added :p
2021-08-04 21647, 2021
16:56 PM
reosarevok looks at this code weird
2021-08-04 21638, 2021
16:57 PM
reosarevok
2021-08-04 21645, 2021
16:58 PM
bitmap
does input/output need to be on the gc object? can't we just import input/output from those files where they're used?
2021-08-04 21601, 2021
16:59 PM
bitmap
that'd avoid the circular dependency afaict
2021-08-04 21650, 2021
16:59 PM
reosarevok
They're used a lot, but probably don't need to be as such?