Support nested package.json files in DefinitelyTyped packages#1194
Closed
Support nested package.json files in DefinitelyTyped packages#1194
Conversation
Copilot
AI
changed the title
[WIP] Some DefinitelyTyped packages may need to include a nested package.json file to control the module type of subfolders, e.g.
- DefinitelyTyped/types/ltx/package.json - main package.json for typings package
Support nested package.json files in DefinitelyTyped packages
Aug 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enables DefinitelyTyped packages to include nested
package.jsonfiles to control module type of subfolders.Problem
Some DefinitelyTyped packages need to include nested
package.jsonfiles in subfolders to control module resolution behavior. For example, a package might need an ESM subfolder with its ownpackage.jsoncontaining"type": "module":Previously, only TypeScript declaration files (
.d.ts) were included when generating packages, so these nestedpackage.jsonfiles were excluded from the published packages.Solution
Modified the
getFiles()function inpackages/definitions-parser/src/lib/definition-parser.tsto include nestedpackage.jsonfiles while preserving all existing behavior:.d.ts,.cts.d.ts,.mts.d.ts)package.jsonfiles (subfolder/package.json)package.json(handled separately by the publisher)Testing
Added comprehensive test coverage:
package.jsonfiles are included ingetFiles()outputThe change is minimal and surgical - only 3 lines modified in the core function to add the new file inclusion logic.
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:
functionscdn.azureedge.netIf you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.