{"record":{"id":"026b7dc83b5f2717","repo":"facebook/docusaurus","slug":"theme-name-plugin-instance-name-does-not-suppor","errorCode":null,"errorMessage":"Theme name=${plugin.instance.name} does not support the code=${'--typescript'} CLI option.","messagePattern":"Theme name=(.+?) does not support the code=(.+?) CLI option\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/docusaurus/src/commands/swizzle/index.ts","lineNumber":44,"sourceCode":"import type {SwizzleAction, SwizzleComponentConfig} from '@docusaurus/types';\nimport type {SwizzleCLIOptions, SwizzlePlugin} from './common';\nimport type {ActionResult} from './actions';\n\nasync function getLanguageForThemeName({\n  themeName,\n  plugins,\n  options,\n}: {\n  themeName: string;\n  plugins: SwizzlePlugin[];\n  options: SwizzleCLIOptions;\n}): Promise<'javascript' | 'typescript'> {\n  const plugin = getPluginByThemeName(plugins, themeName);\n  const supportsTS = !!plugin.instance.getTypeScriptThemePath?.();\n\n  if (options.typescript) {\n    if (!supportsTS) {\n      throw new Error(\n        logger.interpolate`Theme name=${\n          plugin.instance.name\n        } does not support the code=${'--typescript'} CLI option.`,\n      );\n    }\n    return 'typescript';\n  }\n\n  if (options.javascript) {\n    return 'javascript';\n  }\n\n  // It's only useful to prompt the user for themes that support both JS/TS\n  if (supportsTS) {\n    return askSwizzlePreferredLanguage();\n  }\n\n  return 'javascript';","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus/src/commands/swizzle/index.ts#L26-L62","documentation":"Thrown by swizzle's `getLanguageForThemeName` when the user passes `--typescript` but the resolved theme plugin does not implement `getTypeScriptThemePath` (i.e. it has no TypeScript sources). Docusaurus will not synthesize TS files for a JS-only theme.","triggerScenarios":"Running `docusaurus swizzle <theme> <component> --typescript` where `<theme>` only ships JavaScript (its plugin instance has no `getTypeScriptThemePath`).","commonSituations":"Using a community theme that is JS-only; assuming the official `theme-classic` TS support applies to all themes; migrating a JS theme and forgetting it has no `.ts` sources.","solutions":["Drop the `--typescript` flag and let swizzle eject in JavaScript: `docusaurus swizzle <theme> <component>`.","Switch to a theme that ships TypeScript sources (e.g. `@docusaurus/theme-classic`).","If you maintain the theme, implement `getTypeScriptThemePath` on the plugin and ship `.ts`/`.tsx` files."],"exampleFix":"# before\ndocusaurus swizzle my-js-theme Header --typescript  # throws\n# after\ndocusaurus swizzle my-js-theme Header","handlingStrategy":"type-guard","validationCode":"const supportsTS = !!plugin.instance.getTypeScriptThemePath?.();\nif (options.typescript && !supportsTS) {\n  throw new Error(`Theme ${plugin.instance.name} has no TS sources — drop --typescript`);\n}","typeGuard":"function themeSupportsTypeScript(plugin: any): boolean {\n  return typeof plugin?.instance?.getTypeScriptThemePath === 'function'\n    && Boolean(plugin.instance.getTypeScriptThemePath());\n}","tryCatchPattern":"try { await getLanguageForThemeName({themeName, plugins, options}); }\ncatch (e) {\n  if (/does not support the.*--typescript/.test(e.message)) {\n    options.typescript = false; // fall back to JS\n    await getLanguageForThemeName({themeName, plugins, options});\n  } else throw e;\n}","preventionTips":["Detect TS support programmatically before passing `--typescript`.","Default to no language flag and let Docusaurus prompt.","Document which themes ship TS sources in your project README."],"tags":["swizzle","theme","typescript","cli"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}