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
mermaidgraph LR Input[Content-Type value] --> BaseMime[BaseMime] BaseMime --> Headers[HTTP headers] BaseMime --> Validation[Type-safe MIME handling]
Usage
tsimport 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
BaseMimewithimport typewhen it is only used as a TypeScript type. - Use
BaseMimefor 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?