Skip to content

Update type definitions to include custom export#6064

Open
fredrikekelund wants to merge 1 commit into
Unitech:developmentfrom
fredrikekelund:master
Open

Update type definitions to include custom export#6064
fredrikekelund wants to merge 1 commit into
Unitech:developmentfrom
fredrikekelund:master

Conversation

@fredrikekelund

Copy link
Copy Markdown
Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets N/A
License MIT
Doc PR N/A

Tip

Exclude whitespace changes when looking at the PR diff to see that I haven't actually changed all that much.

pm2 exports two members in the programmatic interface: default (an instance of API) and custom (the API class). However, the custom prop is not included in types/index.d.ts.

This PR fixes that problem by moving all function definitions inside an API class in types/index.d.ts. We then use this single definition to declare both the default and custom exports.

I also took the opportunity to update the start type definitions to take an ErrProcsCallback as the second parameter (a callback where the second argument is Proc[] instead of Proc).

@CLAassistant

CLAassistant commented Dec 3, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment thread types/index.d.ts
Comment on lines +786 to +801
type ProcessStatus =
| "online"
| "stopping"
| "stopped"
| "launching"
| "errored"
| "one-launch-status"
| "waiting_restart";
type Platform =
| "ubuntu"
| "centos"
| "redhat"
| "gentoo"
| "systemd"
| "darwin"
| "amazon";

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Several parts of this diff are just auto-formatting. This is one example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants