File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,18 @@ import { typedEntries } from "./src/utils/typedEntries";
55import { createBranch , uploadFilesWithProgress } from "./src" ;
66import { pathToFileURL } from "node:url" ;
77
8+ // Didn't find the import from "node:util", so duplicated it here
9+ type OptionToken =
10+ | { kind : "option" ; index: number ; name: string ; rawName: string ; value: string ; inlineValue: boolean }
11+ | {
12+ kind: "option" ;
13+ index: number ;
14+ name: string ;
15+ rawName: string ;
16+ value: undefined ;
17+ inlineValue: undefined ;
18+ } ;
19+
820const command = process . argv [ 2 ] ;
921const args = process . argv . slice ( 3 ) ;
1022
@@ -242,12 +254,14 @@ function advParseArgs<C extends Command>(
242254 }
243255
244256 const positionals = Object.fromEntries(
245- tokens.filter((token) => token . kind === "positional ") . map ( ( token , i ) => [ expectedPositionals [ i ] . name , token . value ] )
257+ tokens
258+ .filter((token): token is { kind : "positional" ; index : number ; value : string } => token . kind === "positional ")
259+ . map ( ( token , i ) => [ expectedPositionals [ i ] . name , token . value ] )
246260 ) ;
247261
248262 const options = Object . fromEntries (
249263 tokens
250- . filter ( ( token ) => token . kind === "option" )
264+ . filter ( ( token ) : token is OptionToken => token . kind === "option ")
251265 . map ( ( token ) => {
252266 const arg = command . args . find ( ( arg ) => arg . name === token . name || arg . short === token . name ) ;
253267 if ( ! arg ) {
You can’t perform that action at this time.
0 commit comments