Skip to content

BaseMime

reference
1 min readUpdated

Kind: Type

Source: src/utils/mime.ts

Part of: Utils

Union types for BaseMime

BaseMime is a union type that represents the base MIME values defined in src/utils/mime.ts. It constrains APIs and variables that work with those MIME values so callers can pass only members of the union.

Definition

ts
(typeof _baseMimes)[keyof typeof _baseMimes]

Diagram

mermaid
graph LR
  Input[Content-Type value] --> BaseMime[BaseMime]
  BaseMime --> Headers[HTTP headers]
  BaseMime --> Validation[Type-safe MIME handling]

Usage

ts
import type { BaseMime } from './utils/mime';

function createHeaders(mime: BaseMime) {
  return {
    'Content-Type': mime,
  };
}

declare const mime: BaseMime;

const headers = createHeaders(mime);

AI Coding Instructions

  • Import BaseMime with import type when it is only used as a TypeScript type.
  • Use BaseMime for function parameters, configuration fields, and header builders that accept base MIME values.
  • Keep MIME literals aligned with the union declared in src/utils/mime.ts.
  • Do not cast arbitrary strings to BaseMime; validate external input before passing it to typed APIs.

Was this page helpful?

Download as PDF
BaseMime — Hono (narrator proof)