Skip to content

Typescript6 update#367

Open
Jason-Benson wants to merge 7 commits into
FalveyLibraryTechnology:devfrom
Jason-Benson:typescript6_update
Open

Typescript6 update#367
Jason-Benson wants to merge 7 commits into
FalveyLibraryTechnology:devfrom
Jason-Benson:typescript6_update

Conversation

@Jason-Benson

Copy link
Copy Markdown
Contributor

This is the first in a set of updates to allow typescript 6.
One notable change from TS5 is that strict is now implicit, and I updated tsconfig to match previous behavior. A lot more work is needed before ts6 can be used.

@demiankatz demiankatz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, @Jason-Benson! I didn't have time to review this very thoroughly, but I have a few questions and comments below that might be helpful.

There is already quite a lot going on in this PR -- I'd suggest if you do any more, start separate PRs so we can discuss separate issues in separate places, and get things merged as they are finished. Otherwise, this will become hard to keep track of! (I realize it's a balancing act, because if you split things up into too many separate branches, that can lead to merge conflicts and other problems... but I think in this case there's a lot of potential for working in smaller chunks without running into that kind of trouble).

Comment thread api/src/models/Config.ts Outdated
Comment thread api/src/models/Config.ts Outdated
Comment thread api/src/models/Config.ts Outdated

get models(): Record<string, FedoraModel> {
return this.ini["models"] || {};
return (this.ini["models"] as unknown as Record<string, FedoraModel>) || {};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why do we need the as unknown here but not in other places?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It appears that we do not.

Comment thread api/src/models/Config.ts Outdated

get agentDefaults(): Record<string, string> {
return this.ini?.["agent"]?.["defaults"] ?? {};
return ((this.ini["agent"] as ConfigRecord)?.["defaults"] as Record<string, string>) ?? {};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In cases like this, do we need to account for the possibility of an undefined value?

Suggested change
return ((this.ini["agent"] as ConfigRecord)?.["defaults"] as Record<string, string>) ?? {};
return ((this.ini["agent"] as ConfigRecord | undefined)?.["defaults"] as Record<string, string>) ?? {};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I honestly don't know if that's needed, but it works so I'll follow your suggestion.

Comment thread api/package.json Outdated
"supertest": "^7",
"ts-jest": "^29",
"typescript": "^5",
"typescript": "^6",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Did you mean to upgrade typescript here? I thought we were going to try to improve types using typescript 5 before actually upgrading anything.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I had forgotten about that. I backed it off to 5 and got the same test results, so I'll leave it on 5 till the currently broken tests are resolved.

@@ -1,10 +1,7 @@
import sharp from "sharp";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not sure why these sharp changes are showing up here -- they have already been merged to dev. Maybe you need to merge upstream/dev into this branch to straighten things out.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I tried it, but it just reported that I was already up to date.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Did you git fetch upstream before the merge? I can dig into it more deeply tomorrow if it's not that simple. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants