Skip to content

Fix TypeScript type resolution by including all .d.ts files in dist#88

Merged
DanielRosenwasser merged 5 commits intomainfrom
copilot/fix-tas-client-build-errors
Jan 9, 2026
Merged

Fix TypeScript type resolution by including all .d.ts files in dist#88
DanielRosenwasser merged 5 commits intomainfrom
copilot/fix-tas-client-build-errors

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 9, 2026

Fix TypeScript type declaration issues in tas-client ✅

The issue is that the package only publishes a single tas-client.d.ts file that re-exports from other modules, but doesn't include those referenced .d.ts files. This causes TypeScript compilation errors when consumers don't use --skipLibCheck.

Changes:

  • Modified scripts/bundle.js to recursively copy all .d.ts files to dist
  • Updated package.json to add types condition for /bundle export
  • Refactored to use built-in fs.globSync (Node.js 22+) instead of custom function
  • All existing tests pass (34/34)
  • No security issues (CodeQL clean)
  • Validated with @arethetypeswrong/cli
  • Tested with consumer project without --skipLibCheck
  • Code review passed with no issues

Results:

Before: 6x "🥴 Internal resolution error", TS2307 errors, "❌ No types"
After: ✅ All type resolution errors fixed, node10 & bundler fully working (🟢)

The fix ensures all .d.ts files are properly published alongside the main type declaration file, allowing TypeScript to resolve all module references without requiring --skipLibCheck.

Original prompt

This section details on the original issue you should resolve

<issue_title>tas-client doesn't produce error-free builds</issue_title>
<issue_description>If you try to build vscode without --skipLibCheck, several errors come from tas-client.

node_modules/.pnpm/tas-client@0.3.1/node_modules/tas-client/dist/tas-client.d.ts:1:48 - error TS2307: Cannot find module './contracts/IExperimentationFilterProvider.js' or its corresponding type declarations.

1 export { IExperimentationFilterProvider } from './contracts/IExperimentationFilterProvider.js';
                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/tas-client@0.3.1/node_modules/tas-client/dist/tas-client.d.ts:2:41 - error TS2307: Cannot find module './contracts/IExperimentationService.js' or its corresponding type declarations.

2 export { IExperimentationService } from './contracts/IExperimentationService.js';
                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/tas-client@0.3.1/node_modules/tas-client/dist/tas-client.d.ts:3:43 - error TS2307: Cannot find module './contracts/IExperimentationTelemetry.js' or its corresponding type declarations.

3 export { IExperimentationTelemetry } from './contracts/IExperimentationTelemetry.js';
                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/tas-client@0.3.1/node_modules/tas-client/dist/tas-client.d.ts:4:34 - error TS2307: Cannot find module './contracts/IKeyValueStorage.js' or its corresponding type declarations.

4 export { IKeyValueStorage } from './contracts/IKeyValueStorage.js';
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/tas-client@0.3.1/node_modules/tas-client/dist/tas-client.d.ts:5:40 - error TS2307: Cannot find module './tas-client/ExperimentationService.js' or its corresponding type declarations.

5 export { ExperimentationService } from './tas-client/ExperimentationService.js';
                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/tas-client@0.3.1/node_modules/tas-client/dist/tas-client.d.ts:6:46 - error TS2307: Cannot find module './contracts/ExperimentationServiceConfig.js' or its corresponding type declarations.

6 export { ExperimentationServiceConfig } from './contracts/ExperimentationServiceConfig.js';
                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Furthermore, if you look at arethetypeswrong for 400.3.1, you'll see the following table

  "tas-client" "tas-client/bundle"
node10 🥴 Internal resolution error (6) 💀 Resolution failed
node16 (from CJS) ⚠️ ESM (dynamic import only)🚭 Unexpected module syntax🥴 Internal resolution error (6) 🚭 Unexpected module syntax❌ No types⚠️ ESM (dynamic import only)
node16 (from ESM) 🚭 Unexpected module syntax🥴 Internal resolution error (6) 🚭 Unexpected module syntax❌ No types
bundler 🥴 Internal resolution error (6) ❌ No types

tas-client is pretty weird here - it publishes a root .d.ts file, but none of its dependencies. It says it publishes .js files as ESM (via "type": "module"), but the published JS file is closer to a UMD bundle or something. It also advertises a /bundle entry-point into the same file, but with no corresponding types condition.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 9, 2026 19:28
… to dist

Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix build errors in tas-client module Fix TypeScript type resolution by including all .d.ts files in dist Jan 9, 2026
const __dirname = dirname(fileURLToPath(import.meta.url));
const root = join(__dirname, '..');

function copyDirRecursive(src, dest) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot since Node.js 22, there's been a built-in fs.glob/fs.globSync. Maybe use that instead.

https://nodejs.org/api/fs.html#fsglobsyncpattern-options

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.

Done! Refactored to use fs.globSync instead of the custom recursive function. The implementation now uses the built-in API with pattern **/*.d.ts and ignore: 'index.d.ts' option. Commit: b93fc44

@DanielRosenwasser DanielRosenwasser marked this pull request as ready for review January 9, 2026 19:43
@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 9, 2026
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 9, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • default.exp-tas.com
    • Triggering command: /usr/local/bin/node /usr/local/bin/node --conditions development --conditions node /home/REDACTED/work/tas-client/tas-client/tas-client/node_modules/tinypool/dist/entry/process.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Copy Markdown
Member

@DanielRosenwasser DanielRosenwasser left a comment

Choose a reason for hiding this comment

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

The other option I would suggest is using something like tsup or tsdown for declaration file bundling.

@DanielRosenwasser DanielRosenwasser merged commit d02338c into main Jan 9, 2026
4 checks passed
@DanielRosenwasser DanielRosenwasser deleted the copilot/fix-tas-client-build-errors branch January 9, 2026 21:33
@mjbvz
Copy link
Copy Markdown

mjbvz commented Feb 19, 2026

@TylerLeonhardt When you get a chance, can you please publish these changes to npm. Not a huge deal but I did have to work around this issue while adopting tsgo for building VS Code

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.

tas-client doesn't publish error-free files

4 participants