I don't have much to add ot the conversation that took place, other than I agree the cards were a bit too big/too much for listing them.
The editor page looks great.
A small detail that could be improved is the way selected attributes are listed. I think maybe it's another job for a badge with a little "x" on the side (to remove the attribute, would replace the big "Remove" button). Alternatively, the multi-select component we use in the codebase is perfect for that: https://react-select.com/home
Lol, "Type 'Transaction<any, any>' is missing the following properties from type 'Transaction<any, any>': fromRaw, jsonExtract, jsonSet, jsonInsert, and 39 more."
Apparently @types/bookshelf depends on outdated knex typedefs...
monkey
Oh boy, more fun.
kellnerd
So either I'm going to fork the type defs too or I'm trying to survive without them.
i.e. it's a choice between getting sidetracked again or blindly trusting the JS parts in bb-data to work as expected.
monkey
kellnerd: There might be a way to override the typedef package, perhaps?
kellnerd
Yeah, I already had to adapt our tsconfig.json to use the regular @types package for our scoped package:
Yeah, this should do the trick for a native Deno project. Unfortunately this does not work with the npm compatibility layer, that's also why I had to resort to copying files from my local bb-data folder last week.
And I guess I've also been unclear about today's problem:
I'm currently working inside the bb-data repository where I wanted to use Bookshelf types to get a better understanding of what is happening there.
monkey
Ahhh, I see. Issues are in the bb-data repo, I misunderstood.
kellnerd
So rather than "unrelated to Deno" I should have said that I'm not using Deno at all for bb-data
But maybe the "overrides" property in package.json will help, I was only looking for solutions in tsconfig.json so far.
monkey
kellnerd: I'm still unsure where you are using the `@types/knex` package.
But if i remember correctly, the more recent version of knex that we use in our fork of booksheld comes with types already
kellnerd
Unfortunately not
monkey
Huh.
But yes, otherwise `overrides` is the noce package.json way to force resolution to specific packages
kellnerd
I will try that now, if the new types work we can still decide whether we want to upgrade our fork to already include types.
I wonder if I missed something when I deployed our forked package of bookshelf
kellnerd
Wait, I misread: You're writing about @types/knex and I was writing/thinking about @types/bookshelf
It's a bit confusing: The initial error is about outdated Knex types which are shipped with @types/bookshelf
And of course they conflict with the types we have already implicitly installed via knex@2.4.2
monkey
Right. Then indeed I think you'll need to install the `@types/bookshelf` package and then overrride the version of knex in package.json (in bookbrainz-data)
kellnerd
rrrr
monkey
And indeed, afterwards reevaluate if we want to package those types in our bookshelf fork instead
> And of course they conflict with the types we have already implicitly installed via knex@2.4.2
Ah, I missed that sentence
kellnerd
> Overrides is used to support selective version overrides using npm, which lets you define custom package versions or ranges inside your dependencies. For yarn, use resolutions instead.
Since we are using yarn, it seems I have to use "resolutions" ("overrides" had no effect)
monkey
Yes, I forgot about that detail :p
Look at us, using three different JS runtimes !
kellnerd
Honestly I don't understand the syntax for yarn's "resolutions"...
Nothing happens, I guess I have to uninstall the package first.
monkey
Ah, might have to run yarn install again
kellnerd
Hmm, I've even manually deleted @types/bookshelf folder and it is still not doing anything...
(I'm not too familiar with yarn)
I'll eat something before I'll try again.
monkey
Same here
So I added the `resolutions` from above (`**/knex`) and then ran `yarn add @types/bookshelf -D` to add the package. looks like everything is resolved correctly; I see only one version of knex (the expected 2.4.2) and the sub-dependency in `node_modules/@types/bookshelf/node_modules/knex` is a symlink to the 2.4.2 version https://usercontent.irccloud-cdn.com/file/lUwGJ...
I guess the same issues you had with `Transaction`, plus the other issues you might have run into eventually with `QueryBuilder`
I can get typescript compiler to pass, but it requires a couple of small changes in `node_modules/@types/bookshelf/index.d.ts`, which is basically the same as what you were suggesting before ("Now I'm trying to use a modified local .d.ts file instead")
This might be easier than forking and deploying our own version of `@types/bookshelf`: https://yarnpkg.com/cli/patch
kellnerd
Thanks monkey for testing this approach, so I would have to run an explicit yarn add instead of yarn install to apply the changes in package.json, interesting.
But since that isn't sufficient to solve the type issues, I'll probably follow the approach of using our own bookshelf.d.ts instead, for now stored inside bb-data (later we can still move it).
I was going to give it another thorough look tomorrow, but I don't anticipate there's anything left to do.
kellnerd
Great 👍
I had just thought about referencing one of the new files from bb-utils in a commit message in bb-data and was not sure how to permalink to it.
Ugh, trying to understand the usage of types across all BB repos is giving me a headache...
Apparently everybody has just defined types as needed "locally" and there are lots of duplication/inconsistency (e.g. entity types with and without 'id', complete and incomplete, sometimes lazy-loaded data is included, sometimes 'language' refers to an object, sometimes to the ID...)
I've just spend 15 minutes to understand whether an entity type which I am using needs an 'id' property (existing definition in bb-data) or not (my copied definition from bb-utils)
Since bb-utils definitely passes no 'id' and I'm still unsure whether 'id' is needed by other callers of the function in bb-data, I'm currently inclined to create a (third) new type definition where 'id' is optional...
monkey, it'll be nice to have some icons for relationship-types and identifier-types
probably a new one for the Admin Logs too. Haven't been able to find much on the react-fontawesome library
kellnerd
Lol, bookshelf's default inheritance approach is so awkward that the typedef creators decided to mark it as deprecated without telling the project maintainers: https://github.com/bookshelf/bookshelf/issues/1690