Skip to content

Commit

Permalink
Update to Typescript v5.5.0 (#7878)
Browse files Browse the repository at this point in the history
* update to Typescript v5.5.0

* update typescript to version 5.5.x

* changelog

* apply PR feedback

* fix formatting
  • Loading branch information
hotzenklotz committed Jun 25, 2024
1 parent b6930e5 commit 4d10869
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 35 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Made the login, registration, forgot password and dataset dashboard pages more mobile friendly. [#7876](https://github.com/scalableminds/webknossos/pull/7876)
- From now on only project owner get a notification email upon project overtime. The organization specific email list `overTimeMailingList` was removed. [#7842](https://github.com/scalableminds/webknossos/pull/7842)
- Replaced skeleton comment tab component with antd's `<Tree />`component. [#7802](https://github.com/scalableminds/webknossos/pull/7802)
- Updated Typescript to version 5.5.0. [#7878](https://github.com/scalableminds/webknossos/pull/7878)

### Fixed
- Fixed a bug where the warning to zoom in to see the agglomerate mapping was shown to the user even when the 3D viewport was maximized and no volume data was shown. [#7865](https://github.com/scalableminds/webknossos/issues/7865)
Expand Down
8 changes: 4 additions & 4 deletions frontend/javascripts/admin/datastore_health_check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ const pingDataStoreIfAppropriate = memoizedThrottle(async (requestedUrl: string)
return;
}

// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
const stores = datastores
.map((datastore) => ({ ...datastore, path: "data" }))
.concat({ ...tracingstore, path: "tracings" });
const stores = [
{ ...tracingstore, path: "tracings" },
...datastores.map((datastore) => ({ ...datastore, path: "data" })),
];

if (isInMaintenance) {
Toast.warning(messages.planned_maintenance);
Expand Down
1 change: 0 additions & 1 deletion frontend/javascripts/oxalis/api/api_latest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2178,7 +2178,6 @@ class DataApi {

if (
state.localSegmentationData[effectiveLayerName].availableMeshFiles == null ||
// @ts-expect-error ts-migrate(2533) FIXME: Object is possibly 'null' or 'undefined'.
!state.localSegmentationData[effectiveLayerName].availableMeshFiles.find(
(el) => el.meshFileName === meshFileName,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,7 @@ const getResolutionInfoOfActiveSegmentationTracingLayer = memoizeOne(
export function getServerVolumeTracings(
tracings: Array<ServerTracing> | null | undefined,
): Array<ServerVolumeTracing> {
// @ts-expect-error ts-migrate(2322) FIXME: Type 'ServerTracing[]' is not assignable to type '... Remove this comment to see the full error message
const volumeTracings: Array<ServerVolumeTracing> = (tracings || []).filter(
(tracing) => tracing.typ === "Volume",
);
const volumeTracings = (tracings || []).filter((tracing) => tracing.typ === "Volume");
return volumeTracings;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
MISSING_GROUP_ID,
} from "oxalis/view/right-border-tabs/tree_hierarchy_view_helpers";
type GroupNode = {
children: Array<GroupNode>;
children: GroupNode[];
groupId: number | null | undefined;
parent: GroupNode | null | undefined;
};
Expand All @@ -29,7 +29,7 @@ function buildTreeGroupHashMap(skeletonTracing: SkeletonTracing): Record<number,
parent: null,
};

function createSubTree(subTreeRoot: GroupNode, children: Array<TreeGroup>) {
function createSubTree(subTreeRoot: GroupNode, children: TreeGroup[]) {
for (const child of children) {
const childNode = {
children: [],
Expand Down Expand Up @@ -62,9 +62,9 @@ function buildTreeGroupHashMap(skeletonTracing: SkeletonTracing): Record<number,
function findCommonAncestor(
treeIdMap: TreeMap,
groupIdMap: Record<number, GroupNode>,
toggleActions: Array<UpdateTreeVisibilityUpdateAction>,
toggleActions: UpdateTreeVisibilityUpdateAction[],
): number | undefined {
function getAncestorPath(groupId: number | null | undefined): Array<number> {
function getAncestorPath(groupId: number | null | undefined): number[] {
const path = [];
let currentGroupNode: GroupNode | null | undefined =
groupIdMap[groupId == null ? MISSING_GROUP_ID : groupId];
Expand Down Expand Up @@ -114,13 +114,10 @@ function isCommonAncestorToggler(
): [boolean, Tree[], number] {
const groupToTreesMap = createGroupToTreesMap(skeletonTracing.trees);
const groupWithSubgroups = getGroupByIdWithSubgroups(skeletonTracing.treeGroups, commonAncestor);
const allTreesOfAncestor: Array<Tree> =
const allTreesOfAncestor: Tree[] =
groupWithSubgroups.length === 0
? _.values(skeletonTracing.trees)
: _.flatMap(
groupWithSubgroups,
(groupId: number): Array<Tree> => groupToTreesMap[groupId] || [],
);
: _.flatMap(groupWithSubgroups, (groupId: number): Tree[] => groupToTreesMap[groupId] || []);

const [visibleTrees, invisibleTrees] = _.partition(allTreesOfAncestor, (tree) => tree.isVisible);

Expand All @@ -140,9 +137,9 @@ function isCommonAncestorToggler(
}

export default function compactToggleActions(
updateActions: Array<UpdateAction>,
updateActions: UpdateAction[],
tracing: SkeletonTracing | VolumeTracing,
): Array<UpdateAction> {
): UpdateAction[] {
if (tracing.type !== "skeleton") {
// Don't do anything if this is not a skeleton tracing
return updateActions;
Expand All @@ -151,13 +148,11 @@ export default function compactToggleActions(
const skeletonTracing = tracing;

// Extract the toggleActions which we are interested in
const [_toggleActions, remainingActions] = _.partition(
const [toggleActions, remainingActions] = _.partition<UpdateAction>(
updateActions,
(ua) => ua.name === "updateTreeVisibility",
);

const toggleActions = _toggleActions as any as Array<UpdateTreeVisibilityUpdateAction>;

if (toggleActions.length <= 1) {
// Don't try to compact actons if there are no or only one toggleAction(s)
return updateActions;
Expand All @@ -166,7 +161,11 @@ export default function compactToggleActions(
// Build up some helper data structures
const hashMap = buildTreeGroupHashMap(skeletonTracing);
// Find the group id of the common ancestor of all toggled trees
const commonAncestor = findCommonAncestor(skeletonTracing.trees, hashMap, toggleActions);
const commonAncestor = findCommonAncestor(
skeletonTracing.trees,
hashMap,
toggleActions as UpdateTreeVisibilityUpdateAction[],
);
// commonVisibility is the new visibility which should by applied to all ascendants
// of the common ancestor. The exceptions array lists all trees which differ from
// that common visibility. These will receive separate updateActions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ function getSkeletonTracingForConnectome(
layerName: string,
): Maybe<SkeletonTracing> {
if (state.localSegmentationData[layerName].connectomeData.skeleton != null) {
// @ts-expect-error ts-migrate(2322) FIXME: Type 'IMaybe<SkeletonTracing | null | undefined>' ... Remove this comment to see the full error message
return Maybe.Just(state.localSegmentationData[layerName].connectomeData.skeleton);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ class SegmentsView extends React.Component<Props, State> {
const relevantSegments =
groupId != null ? this.getSegmentsOfGroupRecursively(groupId) : this.getSelectedSegments();
if (relevantSegments == null) return [];
const segmentsWithoutPosition: number[] = relevantSegments
const segmentsWithoutPosition = relevantSegments
.filter((segment) => segment.somePosition == null)
.map((segment) => segment.id);
return segmentsWithoutPosition.sort();
Expand Down
19 changes: 14 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"sinon": "^12.0.1",
"tmp": "0.0.33",
"ts-loader": "^9.4.1",
"typescript": "^5.3.0",
"typescript": "^5.5.0",
"typescript-coverage-report": "^0.8.0",
"webpack": "^5.74.0",
"webpack-cli": "^5.1.4",
Expand Down Expand Up @@ -220,14 +220,23 @@
"**/rc-tree": "^5.7.12"
},
"ava": {
"files": ["./public-test/test-bundle/**/*.{js,jsx}"],
"ignoredByWatcher": ["./binaryData/**/*.*"],
"require": ["./frontend/javascripts/test/_ava_polyfill_provider.ts"],
"files": [
"./public-test/test-bundle/**/*.{js,jsx}"
],
"ignoredByWatcher": [
"./binaryData/**/*.*"
],
"require": [
"./frontend/javascripts/test/_ava_polyfill_provider.ts"
],
"snapshotDir": "frontend/javascripts/test/snapshots",
"concurrency": 8
},
"c8": {
"exclude": ["public-test/test-bundle/test/**/*.*", "frontend/javascripts/test/**/*.*"],
"exclude": [
"public-test/test-bundle/test/**/*.*",
"frontend/javascripts/test/**/*.*"
],
"reporter": "lcov"
}
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11485,10 +11485,10 @@ typescript@^5.2.2:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.4.tgz#eb2471e7b0a5f1377523700a21669dce30c2d952"
integrity sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw==

typescript@^5.3.0:
version "5.3.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37"
integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==
typescript@^5.5.0:
version "5.5.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.2.tgz#c26f023cb0054e657ce04f72583ea2d85f8d0507"
integrity sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==

uc.micro@^1.0.1, uc.micro@^1.0.5:
version "1.0.6"
Expand Down

0 comments on commit 4d10869

Please sign in to comment.