Skip to content

feat: add generic for extending Hooks on config.runHook - #1359

Merged
cristiand391 merged 1 commit into
oclif:cd/handle-1359from
kanadgupta:main
Apr 25, 2025
Merged

cristiand391 merged 1 commit into
oclif:cd/handle-1359from
kanadgupta:main

Conversation

@kanadgupta

Copy link
Copy Markdown
Contributor

The Hook interface has a handy generic so we can have additional type safety around hook inputs/outputs:

export type Hook<T extends keyof P, P extends Hooks = Hooks> = (

This PR extends that logic over to the config.runHook method.

@kanadgupta

Copy link
Copy Markdown
Contributor Author

Apologies for the tag @mdonnalley — mind taking a look at this?

@cristiand391

Copy link
Copy Markdown
Contributor

hey @kanadgupta, sorry for the late reply!
Mike is currently on PTO, I'll schedule some time to review this PR on Thursday 24

@cristiand391

Copy link
Copy Markdown
Contributor

PR looks good but and got tests running by pushing a parallel branch but there's something with latest node v23 that broke our current unit tests (pretty sure it's unrelated to your changes).
I'll merge your PR into a separate branch and fix our tests there.

thanks for contributing!

@cristiand391
cristiand391 changed the base branch from main to cd/handle-1359 April 25, 2025 15:28
@cristiand391
cristiand391 merged commit e056185 into oclif:cd/handle-1359 Apr 25, 2025
cristiand391 added a commit that referenced this pull request Apr 28, 2025
…1362)

* feat: add generic for extending `Hooks` on `config.runHook` (#1359)

---------

Co-authored-by: Kanad Gupta <github@kanad.dev>
kanadgupta added a commit to readmeio/rdme that referenced this pull request Apr 28, 2025
kanadgupta added a commit to readmeio/rdme that referenced this pull request Apr 28, 2025
## 🧰 Changes

- [x] bumps our openapi definition to the latest version
- [x] updates our types to incorporate
oclif/core#1359
- [x] also bumps a few deps, see below...

**before**

```
Package                     Current   Wanted   Latest  Location                                 Depended by
@oclif/plugin-autocomplete   3.2.26   3.2.27   3.2.27  node_modules/@oclif/plugin-autocomplete  rdme
@types/validator            13.12.3  13.15.0  13.15.0  node_modules/@types/validator            rdme
@vitest/coverage-v8           3.1.1    3.1.2    3.1.2  node_modules/@vitest/coverage-v8         rdme
@vitest/expect                3.1.1    3.1.2    3.1.2  node_modules/@vitest/expect              rdme
eslint                       8.57.1   8.57.1   9.25.1  node_modules/eslint                      rdme
ignore                        7.0.3    7.0.4    7.0.4  node_modules/ignore                      rdme
knip                         5.46.4   5.50.5   5.50.5  node_modules/knip                        rdme
nock                         14.0.2   14.0.4   14.0.4  node_modules/nock                        rdme
rollup                       4.38.0   4.40.1   4.40.1  node_modules/rollup                      rdme
type-fest                    4.39.0   4.40.1   4.40.1  node_modules/type-fest                   rdme
typescript                    5.8.2    5.8.3    5.8.3  node_modules/typescript                  rdme
undici                       5.29.0   5.29.0    7.8.0  node_modules/undici                      rdme
vitest                        3.1.1    3.1.2    3.1.2  node_modules/vitest                      rdme
```

**after**

```
Package  Current  Wanted  Latest  Location             Depended by
eslint    8.57.1  8.57.1  9.25.1  node_modules/eslint  rdme
undici    5.29.0  5.29.0   7.8.0  node_modules/undici  rdme
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants