Skip to content

Conversation

@rossiam
Copy link
Collaborator

@rossiam rossiam commented Aug 11, 2022

  • make the Sorting interface generic, dependent on the type of the object being sorted (this was the key to removing the need for the ts-ignore comments in command-util.ts)
    • changed type of primaryKeyName and sortingKeyName for Sorting interface to constrain them to string keys from the object being sorted
    • this also necessitated adding types to config instances throughout the CLI passed into these functions and a bit of other type-related updates to some commands
  • add extends object constraint to objects handled by command helper functions
  • rename outputListing to outputItemOrList and outputListingGeneric to outputItemOrListGeneric (updated note about renaming them to a note about combining them)
  • update/add config types for command helper functions with consistent naming (InputAndOutputItemConfig for inputAndOutputItem, FormatAndWriteItemConfig for formatAndWriteItem, etc.)

Checklist

  • I have read the CONTRIBUTING document
  • Any required documentation has been added
  • My code follows the code style of this project (npm run lint produces no warnings/errors)
  • I have added tests to cover my changes

@rossiam rossiam requested review from bflorian and john-u August 11, 2022 19:38
@changeset-bot
Copy link

changeset-bot bot commented Aug 11, 2022

🦋 Changeset detected

Latest commit: 629bb60

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@smartthings/cli-lib Patch
@smartthings/cli-testlib Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@rossiam rossiam requested a review from Sitlintac August 15, 2022 21:56
* make the `Sorting` interface generic, dependent on the type of the object being sorted (this was the key to removing the need for the `ts-ignore` comments in `command-util.ts`)
  * changed type of `primaryKeyName` and `sortingKeyName` for `Sorting` interface to constrain them to string keys from the object being sorted
  * this also necessitated adding types to `config` instances throughout the CLI passed into these functions and a bit of other type-related updates to some commands
* add `extends object` constraint to objects handled by command helper functions
* rename `outputListing` to `outputItemOrList` and `outputListingGeneric` to `outputItemOrListGeneric` (updated note about renaming them to a note about combining them)
* update/add config types for command helper functions with consistent naming (`InputAndOutputItemConfig` for `inputAndOutputItem`, `FormatAndWriteItemConfig` for `formatAndWriteItem`, etc.)
@rossiam rossiam force-pushed the helper-function-cleanup branch from 1234578 to 629bb60 Compare August 17, 2022 15:30
@rossiam rossiam merged commit ea04f1e into SmartThingsCommunity:master Aug 17, 2022
@rossiam rossiam deleted the helper-function-cleanup branch August 17, 2022 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants