Skip to content

fix(douyin): narrow getDraftCommand return type to fix TS2722 build failure#643

Merged
jackwener merged 1 commit intomainfrom
fix/draft-test-ts2722
Mar 31, 2026
Merged

fix(douyin): narrow getDraftCommand return type to fix TS2722 build failure#643
jackwener merged 1 commit intomainfrom
fix/draft-test-ts2722

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

  • Fix tsc --noEmit build failure introduced by fix(douyin): repair creator draft flow #640's draft test refactoring
  • getDraftCommand() returns CliCommand where func is optional, causing TS2722 at every cmd.func(...) call site
  • Add type narrowing assertion: cmd as typeof cmd & { func: NonNullable<typeof cmd.func> } so TypeScript knows func is defined after the runtime guard

Test plan

  • npx tsc --noEmit passes (no draft.test.ts errors)
  • npx vitest run src/clis/douyin/draft.test.ts --project adapter — 10/10 pass

@jackwener jackwener merged commit 811e4f5 into main Mar 31, 2026
9 checks passed
@jackwener jackwener deleted the fix/draft-test-ts2722 branch March 31, 2026 14:59
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.

1 participant