Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Parse method doesn't work without passing class #192

Open
arifmahmudrana opened this issue Jan 10, 2021 · 0 comments
Open

Parse method doesn't work without passing class #192

arifmahmudrana opened this issue Jan 10, 2021 · 0 comments

Comments

@arifmahmudrana
Copy link

arifmahmudrana commented Jan 10, 2021

Base abstract child

import { Command, flags } from '@oclif/command'

abstract class AP extends Command {
  static flags = {
    help: flags.help({ char: 'h' }),
    file: flags.string({
      description: 'File path',
      required: true,
    }),
  }

  async run() {
    const { flags } = this.parse() // It should work without class name so that it can be dynamic
    console.log(flags.file)
  }
}

export default AP

Child class

import AP from '../../abstract/ap'

export default class API extends AP {
  static description = `Extended`

  static examples = [`$ my-cli api`]

  static flags = AP.flags
}

export default API

But it shows error Property 'file' does not exist on type 'unknown'.ts(2339)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant