Skip to content

Conversation

@mass3ff3ct
Copy link
Contributor

Проблема

На текущий момент нет возможности расширить объект run при использовании билд хуков getBuildHooks

Решение

В getBuildHooks добавить generic тип, способный расширить объект run, по примеру с getBaseHooks

пример:
import type {Run as BaseRun} from '@diplodoc/cli/lib/run'
import type {BaseConfig} from '@diplodoc/cli/lib/program'


type MyConfig = BaseConfig & {prop: string}

type Run = BaseRun<MyConfig>

.....

getBuildHooks<Run>(program).BeforeRun.for('html').tap('Name', (run) => {
    if (!run.config.prop) { // No ts error
       return
    }

    .....
})

@3y3 3y3 force-pushed the master branch 5 times, most recently from c7ab6c3 to 14d671e Compare August 26, 2025 09:04
@3y3 3y3 force-pushed the master branch 9 times, most recently from 52f2688 to 50a4135 Compare September 15, 2025 14:36
@3y3 3y3 force-pushed the master branch 13 times, most recently from 0e25585 to 5cf33d5 Compare September 22, 2025 17:22
@3y3 3y3 force-pushed the master branch 3 times, most recently from 2698a95 to cfe7e59 Compare September 22, 2025 18:21
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