Skip to content

Type error when adding aliases #91

@jrmajor

Description

@jrmajor

Describe the bug
Adding flag aliases causes type errors when using func or specific loader styles.

To Reproduce

buildCommand({
  parameters: {
    flags: {
      repo: {
        kind: 'parsed',
        parse: String,
        brief: '',
      },
    },
    aliases: {
      r: 'repo', // ts error: Type 'string' is not assignable to type 'undefined'.
    },
  },
  docs: { brief: 'Add release to releases.txt' },
  // ts error in the next line. it disappears when you remove aliases.
  func({ repo }: { repo: string }) {
    console.log(repo);
  },
});

See reproduction here: https://stackblitz.com/edit/stricli-alias-repro?file=cli.ts.

There are three examples in linked file, out of which second and third have type errors.

Expected behavior
No type errors.

Environment (please complete the following information):

  • Operating System and Version: macOS 15.5
  • Browser [e.g. Firefox, Safari] (if applicable): N/A

Additional context
Thank you for maintaining this library :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐜Something isn't workingcore ⚙Relates to the @stricli/core package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions