Thing is, a later pipeline step accepting string | number can handle an output of just number. But I can't tell Typescript "this type can be anything as long as it also accepts number" in a way that generates a type error for the function argument of connect.
If you're wondering how this leads to Markdown files being turned into HTML with templates, the process is comprised of these steps:
Page<".md", string, {}> -> Page<".md", string, frontmatter data> -> Page<".html", string, frontmatter data>
Anything that becomes Page<".html", string, ...> before the template hook in the pipeline will be processable by templates ingesting Page<".html", string, ...>.
I generalized the concept of templates to work with any page type. Most of the time they're going to ingest Page<".html", string, ...> as shown here, but you could have templates for anything