Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deno: Property argv does not exist on type YargsInstance #2035

Closed
seanaye opened this issue Sep 24, 2021 · 1 comment
Closed

Deno: Property argv does not exist on type YargsInstance #2035

seanaye opened this issue Sep 24, 2021 · 1 comment
Labels

Comments

@seanaye
Copy link

seanaye commented Sep 24, 2021

I have copied the example deno usage into a file but it will not compile due to error Property argv does not exist on type YargsInstance

I am using Deno version: 1.12.2

Code from readme (more or less)

import yargs from 'https://deno.land/x/yargs/deno.ts'
import { Arguments } from 'https://deno.land/x/yargs/deno-types.ts'

const input = yargs(Deno.args)
  .command('download <files...>', 'download a list of files', (yargs: any) => {
    return yargs.positional('files', {
      describe: 'a list of files to do something with'
    })
  }, (argv: Arguments) => {
    console.info(argv)
  })
  .strictCommands()
  .demandCommand(1)

console.log(input.argv)
@bcoe bcoe added the question label Sep 25, 2021
@bcoe
Copy link
Member

bcoe commented Sep 25, 2021

@seanaye we removed the .argv property accessor from Deno and ESM versions of yargs, I've confirmed that the following works on deno@1.14.1:

import yargs from 'https://deno.land/x/yargs/deno.ts'
import { Arguments } from 'https://deno.land/x/yargs/deno-types.ts'

const input = yargs(Deno.args)
  .command('download <files...>', 'download a list of files', (yargs: any) => {
    return yargs.positional('files', {
      describe: 'a list of files to do something with'
    })
  }, (argv: Arguments) => {
    console.info(argv)
  })
  .strictCommands()
  .demandCommand(1)

console.log(input.parse())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants