Skip to content

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Sep 23, 2025

Part of COMPASS-8170

Adds typecheck to the check of 6 packages. While some typechecking happens on compile, it misses the test files. This will make sure we're catching it.

We are still missing typecheck in mongodb-data-service and @mongodb-js/compass-components. Those will require more changes so it'll be better to do them in isolation. Looks like @mongodb-js/compass-crud also isn't running the right typecheck.

'use strict';

const path = require('path');

const { getPackagesInTopologicalOrder, findMonorepoRoot } = require('@mongodb-js/monorepo-tools');

async function runCheck() {
  const monorepoRoot = await findMonorepoRoot();
  const packages = await getPackagesInTopologicalOrder(monorepoRoot);
  for (const packageInfo of packages) {
    // eslint-disable-next-line @typescript-eslint/no-var-requires
    const packageJson = require(
      path.join(packageInfo.location, 'package.json'),
    );
    if (!packageJson.scripts.typecheck && packageJson.devDependencies?.typescript) {
      console.log(packageInfo.name);
    }
  }
}

runCheck();
node ./scripts/check-typecheck-exists.js

@Anemy Anemy requested a review from a team as a code owner September 23, 2025 18:58
@Anemy Anemy requested review from Copilot and gribnoysup September 23, 2025 18:58
@Anemy Anemy added the no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion) label Sep 23, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds typecheck functionality to the check scripts for 6 packages as part of COMPASS-8170, ensuring TypeScript type checking includes test files that are normally missed during compilation.

  • Added typecheck script to 6 package.json files
  • Updated existing check scripts to run typecheck first
  • Fixed various TypeScript type errors in test files to support proper type checking

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/explain-plan-helper/src/index.spec.ts Fixed null/undefined handling with optional chaining and non-null assertions
packages/explain-plan-helper/package.json Added typecheck script and updated check command
packages/databases-collections-list/src/index.spec.tsx Added proper TypeScript types for function parameters and test data
packages/databases-collections-list/package.json Added typecheck script and updated check command
packages/compass-logging/package.json Added typecheck script and updated check command
packages/compass-data-modeling/src/components/drawer/relationships-section.tsx Added CSS overflow properties to button styles
packages/compass-connections-navigation/src/virtual-list/virtual-list.spec.tsx Fixed getItemActions return type and added missing getContextMenuGroups prop
packages/compass-connections-navigation/src/connections-navigation-tree.spec.tsx Added type assertions for Connection objects
packages/compass-connections-navigation/package.json Added typecheck script and updated check command
packages/compass-app-registry/package.json Added typecheck script and updated check command
configs/webpack-config-compass/package.json Added typecheck script and updated check command

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

maxHeight: 20, // To match accordion line height
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
Copy link
Member Author

Choose a reason for hiding this comment

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

Ah accidentally included this drive by. Fixes
image

@Anemy Anemy merged commit 94dc4fe into main Sep 24, 2025
60 checks passed
@Anemy Anemy deleted the add-typecheck-to-packages branch September 24, 2025 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants