import type { BundledLanguage, BundledTheme, HighlighterGeneric, LanguageInput, SpecialLanguage, SpecialTheme, ThemeInput } from 'shiki/types'; export type Langs = BundledLanguage | SpecialLanguage; export type Themes = BundledTheme | SpecialTheme; export type LangsMap = Partial>; export type ThemesMap = Partial>; export type Highlighter = HighlighterGeneric; export type HighlighterBundle = Pick, 'codeToHast' | 'codeToHtml' | 'codeToTokens' | 'codeToTokensBase' | 'codeToTokensWithThemes'>; type WithPartialOptions = { [K in keyof T]: T[K] extends (code: infer C, options: infer O) => infer R ? (code: C, options?: Partial) => R : T[K]; }; export type Shorthands = WithPartialOptions> & { highlighter: Highlighter; }; /** * Extract the bundled languages from a Highlighter or Shorthands type. */ export type InferLangs = H extends Shorthands ? L : H extends Highlighter ? L : never; /** * Extract the bundled themes from a Highlighter or Shorthands type. */ export type InferThemes = H extends Shorthands ? T : H extends Highlighter ? T : never; export {};