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

Parse method doesn't work without passing class #192

Description

@arifmahmudrana

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions