Skip to content

Type design: VideoInfo raw/validated split, callback-data codec, context narrowing #10

Description

@miridius

From the /review-pr baseline (type-design-analyzer):

  • VideoInfo understates the real payload (formats/resolution/format_id/extractor/playlist_title/id consumed via any in logFormats/parseRes/parseCaption) and overstates optionality (webpage_url). Split RawVideoInfo (mirrors yt-dlp) from validated VideoInfo (webpage_url required) built by one parse function; deletes the ! and the anys.
  • Callback data protocol is stringly typed and split across produce (dl:${id}) and parse (regex) sites — add encodeCallback/decodeCallback pair.
  • types.ts CallbackQueryContext should narrow to Update.CallbackQueryUpdate<CallbackQuery.DataQuery> (and/or use callbackQuery('data') filter), deleting (ctx.callbackQuery as any).data.
  • LogMessage/NoLog: extract a Log interface; NoLog as standalone null object instead of subclass-with-no-op-overrides.
  • memoize key type says string | false but runtime treats '' as skip-cache — align.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions