File tree Expand file tree Collapse file tree
packages/nuxt-cli/test/unit Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import type { CommandDef } from 'citty'
1+ import type { CommandDef , Resolvable } from 'citty'
22
33import { renderUsage } from 'citty'
44import { describe , expect , it } from 'vitest'
55
66import { commands } from '../../src/commands'
77import { main } from '../../src/main'
88
9- async function resolve ( def : CommandDef ) : Promise < CommandDef > {
9+ async function resolve ( def : Resolvable < CommandDef > ) : Promise < CommandDef > {
1010 return typeof def === 'function' ? await def ( ) : def
1111}
1212
13- async function usage ( def : CommandDef , parent ?: CommandDef ) : Promise < string > {
13+ async function usage ( def : Resolvable < CommandDef > , parent ?: Resolvable < CommandDef > ) : Promise < string > {
1414 const rendered = await renderUsage ( await resolve ( def ) , parent ? await resolve ( parent ) : undefined )
1515 return rendered . replace ( / v \d + \. \d + \. \d [ ^ \s ) ] * / g, 'v0.0.0' )
1616}
1717
18- async function subCommand ( parent : CommandDef , name : string ) : Promise < CommandDef > {
18+ async function subCommand ( parent : Resolvable < CommandDef > , name : string ) : Promise < CommandDef > {
1919 const resolved = await resolve ( parent )
2020 const subCommands = await ( typeof resolved . subCommands === 'function' ? resolved . subCommands ( ) : resolved . subCommands )
2121 return subCommands ! [ name ] as CommandDef
You can’t perform that action at this time.
0 commit comments