Skip to content

Conversation

@kraenhansen
Copy link
Collaborator

@kraenhansen kraenhansen commented Oct 15, 2025

Description

I found many of the packages were repeating a lot for values that could be lifted to the common tsconfig using a new feature of the TypeScript compiler.

Merging this PR will:

  • Simplify package tsconfigs to not repeat the "include", "exclude" and "outDir" properties, using the ${configDir} template variable introduced in TypeScript 5.5. Since these are settings which are normally overridden by the extending configuration, I don't expect these additions to cause any downstream breakage.
  • Remove unused "allowJs": true from packages with no JS to discourage use of JS where TS could be used.
  • Remove unused "strict": true and "esModuleInterop": true in package tsconfigs, which are inherited from the common config.
  • Update the create-workspace script accordingly.
  • Update tsconfigs with simple "jsx": "react" settings to simply extend our react-specific config.
  • Aligning download-url package with the others, to output into ./dist instead of ./lib.

Open Questions

Checklist

"bootstrap": "npm run compile",
"prepublishOnly": "npm run compile",
"compile": "tsc -p tsconfig.json && gen-esm-wrapper . ./.esm-wrapper.mjs && prettier --write .esm-wrapper.mjs",
"compile": "tsc -p tsconfig.json && gen-esm-wrapper . ./dist/.esm-wrapper.mjs",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moving the esm-wrapper into the dist directory like every other package.

@kraenhansen kraenhansen self-assigned this Oct 15, 2025
@kraenhansen kraenhansen marked this pull request as ready for review October 15, 2025 19:06
@coveralls
Copy link

Coverage Status

coverage: 73.539% (+2.0%) from 71.5%
when pulling e983925 on kh/simpler-tsconfig
into 4fb85bd on main.

@kraenhansen kraenhansen requested a review from addaleax October 17, 2025 12:12
Copy link
Collaborator

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

Seems like a reasonable way to align packages more 🙂

@@ -1,15 +1,9 @@
{
"extends": "@mongodb-js/tsconfig-devtools/tsconfig.common.json",
"extends": "@mongodb-js/tsconfig-devtools/tsconfig.react.json",
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's no react in devtools-connect anymore, right? If you're referring to the "jsx": "react" bit below, I think you can just remove that at this point

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was referring to the "jsx": "react" yes. Reverted this change and it still builds 👍

"strict": true
},
"include": ["src/**/*"],
"exclude": ["./src/types/*"],
Copy link
Collaborator

Choose a reason for hiding this comment

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

^ This exclude isn't kept, right?

I'm a bit confused though, I don't think this worked previously as intended, with two keys of the same name in this file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah - it never worked 🙃 Just tested by reverting this change and tsc --listFiles. Also - even when in the exclude the package source files pull them in.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes I probably just messed up.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well, it all seems to work 🤷‍♀️ Basically just checking whether we should start to explicitly exclude these files now

@kraenhansen kraenhansen merged commit f7f4402 into main Oct 17, 2025
33 checks passed
@kraenhansen kraenhansen deleted the kh/simpler-tsconfig branch October 17, 2025 15:46
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.

5 participants