Socket
Socket
Sign inDemoInstall

@commander-js/extra-typings

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commander-js/extra-typings - npm Package Compare versions

Comparing version 10.0.3 to 11.0.0

esm.d.mts

11

package.json
{
"name": "@commander-js/extra-typings",
"version": "10.0.3",
"version": "11.0.0",
"description": "Infer strong typings for commander options and action handlers",

@@ -16,2 +16,3 @@ "main": "index.js",

"esm.mjs",
"esm.d.mts",
"index.js",

@@ -23,7 +24,5 @@ "index.d.ts"

".": {
"types": "./index.d.ts",
"require": "./index.js",
"import": "./esm.mjs"
},
"./esm.mjs": "./esm.mjs"
}
},

@@ -51,3 +50,3 @@ "types": "index.d.ts",

"peerDependencies": {
"commander": "10.0.x"
"commander": "11.0.x"
},

@@ -57,3 +56,3 @@ "devDependencies": {

"@types/node": "^18.7.16",
"commander": "~10.0.0",
"commander": "~11.0.0",
"jest": "^29.3.1",

@@ -60,0 +59,0 @@ "ts-jest": "^29.0.5",

@@ -35,3 +35,3 @@ # extra-typings for commander

```js
```typescript
import { program } from '@commander-js/extra-typings';

@@ -49,3 +49,3 @@

```js
```typescript
import { Command } from '@commander-js/extra-typings';

@@ -59,3 +59,3 @@

```js
```typescript
import { Command } from '@commander-js/extra-typings';

@@ -68,1 +68,10 @@

```
Use a "const assertion" on the choices to narrow the option type from `string`:
```typescript
const program = new Command()
.addOption(new Option('--drink-size <size>').choices(['small', 'medium', 'large'] as const))
.parse();
const drinkSize = program.opts().drinkSize; // "small" | "medium" | "large" | undefined
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc