Skip to content

Add type declarations for PrismJS component dependencies and loader#74420

Open
tcaesvk wants to merge 1 commit intoDefinitelyTyped:masterfrom
tcaesvk:feature/prismjs-dependencies
Open

Add type declarations for PrismJS component dependencies and loader#74420
tcaesvk wants to merge 1 commit intoDefinitelyTyped:masterfrom
tcaesvk:feature/prismjs-dependencies

Conversation

@tcaesvk
Copy link
Contributor

@tcaesvk tcaesvk commented Jan 30, 2026

Please fill in this template.

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change.
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run pnpm test <package to test>.
  • Provide a URL to documentation or source code which provides context for the suggested changes: <<prismjs/dependencies.js>>
  • If this PR brings the type definitions up to date with a new version of the JS library, update the version number in the package.json.

This PR add a declaration file for submodule to prevent TS7016 Could not find a declaration file for module 'prismjs/dependencies.js' error message by noImplicitAny option.

@typescript-bot
Copy link
Contributor

typescript-bot commented Jan 30, 2026

@tcaesvk Thank you for submitting this PR!

This is a live comment that I will keep updated.

1 package in this PR

Code Reviews

Because this is a widely-used package, a DT maintainer will need to review it before it can be merged.

You can test the changes of this PR in the Playground.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • 🕐 Only a DT maintainer can approve changes without tests

Once every item on this list is checked, I'll ask you for permission to merge and publish the changes.

Inactive

This PR has been inactive for 7 days.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 74420,
  "author": "tcaesvk",
  "headCommitOid": "b52973155ce65f4ab88aa263a69ec34a058b7788",
  "mergeBaseOid": "ab0b2c621246bfd1bf503a7c5e06735451fc7cb5",
  "lastPushDate": "2026-01-30T02:58:17.000Z",
  "lastActivityDate": "2026-02-06T03:23:42.000Z",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "prismjs",
      "kind": "edit",
      "files": [
        {
          "path": "types/prismjs/dependencies.d.ts",
          "kind": "definition"
        }
      ],
      "owners": [
        "RunDevelopment",
        "ExE-Boss",
        "eriklieben",
        "andrewiggins",
        "typeofweb"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "stale",
      "reviewer": "sheetalkamat",
      "date": "2026-02-03T19:37:54.000Z",
      "abbrOid": "0cbbcec"
    },
    {
      "type": "stale",
      "reviewer": "RunDevelopment",
      "date": "2026-02-03T12:37:52.000Z",
      "abbrOid": "0cbbcec"
    }
  ],
  "mainBotCommentID": 3821539478,
  "ciResult": "pass"
}

@typescript-bot
Copy link
Contributor

Hey @tcaesvk,

😒 Your PR doesn't modify any tests, so it's hard to know what's being fixed, and your changes might regress in the future. Please consider adding tests to cover the change you're making. Including tests allows this PR to be merged by yourself and the owners of this module.

This can potentially save days of time for you!

@typescript-bot
Copy link
Contributor

🔔 @RunDevelopment @ExE-Boss @eriklieben @andrewiggins @typeofweb — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in Pull Request Status Board Jan 30, 2026
@tcaesvk tcaesvk force-pushed the feature/prismjs-dependencies branch from 82b2918 to 2596e81 Compare January 30, 2026 07:08
@typescript-bot typescript-bot moved this from Needs Maintainer Review to Waiting for Code Reviews in Pull Request Status Board Jan 30, 2026
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in Pull Request Status Board Jan 30, 2026
@tcaesvk
Copy link
Contributor Author

tcaesvk commented Jan 30, 2026

Formatting

The following files are not formatted:

  1. types/prismjs/dependencies.d.ts

Consider running pnpm dprint fmt on these files to make review easier.

The types/prismjs/dependencies.d.ts file has now been formatted using the npx dprint fmt command.

Copy link
Contributor

@RunDevelopment RunDevelopment left a comment

Choose a reason for hiding this comment

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

The definition of ComponentEntry needs a tiny change. Otherwise gtg.

Comment on lines 2 to 10
title: string;
owner: string;
noCSS?: boolean;
alias: string | readonly string[];
aliasTitles: Readonly<Record<string, string>>;

optional: string | readonly string[];
require: string | readonly string[];
modify: string | readonly string[];
Copy link
Contributor

Choose a reason for hiding this comment

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

According to this type def, all these properties should be optional, not just noCSS.

I'm not sure why even title is otpional, but I probably had my reasons back then.

Suggested change
title: string;
owner: string;
noCSS?: boolean;
alias: string | readonly string[];
aliasTitles: Readonly<Record<string, string>>;
optional: string | readonly string[];
require: string | readonly string[];
modify: string | readonly string[];
title?: string;
owner?: string;
noCSS?: boolean;
alias?: string | readonly string[];
aliasTitles?: Readonly<Record<string, string>>;
optional?: string | readonly string[];
require?: string | readonly string[];
modify?: string | readonly string[];

Copy link
Contributor Author

@tcaesvk tcaesvk Feb 3, 2026

Choose a reason for hiding this comment

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

I amended commit according to JSDoc optional syntax

@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Feb 1, 2026
@typescript-bot typescript-bot moved this from Needs Maintainer Review to Needs Author Action in Pull Request Status Board Feb 1, 2026
@typescript-bot
Copy link
Contributor

@tcaesvk One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits. Thank you!

@tcaesvk tcaesvk force-pushed the feature/prismjs-dependencies branch from 2596e81 to 0cbbcec Compare February 3, 2026 05:36
@typescript-bot typescript-bot removed the Revision needed This PR needs code changes before it can be merged. label Feb 3, 2026
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in Pull Request Status Board Feb 3, 2026
@typescript-bot
Copy link
Contributor

@RunDevelopment Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in Pull Request Status Board Feb 3, 2026
Copy link
Contributor

@RunDevelopment RunDevelopment left a comment

Choose a reason for hiding this comment

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

LGTM;

@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label Feb 3, 2026
@typescript-bot
Copy link
Contributor

⏳ Hi @tcaesvk,

It's been a few days since this PR was approved by RunDevelopment and we're waiting for a DT maintainer to give a review.

If you would like to short-circuit this wait, you can edit some of the test files in the package that verify how the .d.ts files work. This would allow the PR to be merged by you or the DT module owners after a re-review.

load: LoadFunction;
}

export default function getLoader(
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs export = instead of export default. Refer to https://github.com/DefinitelyTyped/DefinitelyTyped#a-package-uses-export--but-i-prefer-to-use-default-imports-can-i-change-export--to-export-default

c:\temp\test2>type a.js
var a = require("prismjs/dependencies.js")
console.log(a)
console.log(a.default)
c:\temp\test2>node a.js
[Function: getLoader]
undefined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I amended as you requested.

Copy link
Contributor

@sheetalkamat sheetalkamat left a comment

Choose a reason for hiding this comment

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

Please address feedback

@typescript-bot typescript-bot added Revision needed This PR needs code changes before it can be merged. and removed Owner Approved A listed owner of this package signed off on the pull request. labels Feb 3, 2026
@typescript-bot
Copy link
Contributor

@tcaesvk One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits. Thank you!

@typescript-bot typescript-bot moved this from Needs Maintainer Review to Needs Author Action in Pull Request Status Board Feb 3, 2026
@tcaesvk tcaesvk force-pushed the feature/prismjs-dependencies branch from 0cbbcec to b529731 Compare February 6, 2026 03:21
@typescript-bot typescript-bot removed the Revision needed This PR needs code changes before it can be merged. label Feb 6, 2026
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in Pull Request Status Board Feb 6, 2026
@tcaesvk tcaesvk requested a review from sheetalkamat February 6, 2026 03:21
@typescript-bot
Copy link
Contributor

@sheetalkamat, @RunDevelopment Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in Pull Request Status Board Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Critical package Untested Change This PR does not touch tests

Projects

Status: Needs Maintainer Review

Development

Successfully merging this pull request may close these issues.

4 participants