DOCXKIT_STYLE_CIRCULAR_EXTENDS: Circular style inheritance
The extends chain references a style that is already being resolved.
What to do
- Follow the chain shown in the message.
- Remove a reference that closes the cycle; shared parents are allowed.
Problem example
ts
import { createDocx, defineStyles } from 'docx-kit'
const styles = defineStyles({
body: { extends: 'title' }, title: { extends: 'body' },
})
await createDocx({ styles }).p('Hello', { className: 'body' }).toBlob()Corrected example
ts
import { createDocx, defineStyles } from 'docx-kit'
const styles = defineStyles({
body: { fontSize: 12 }, title: { extends: 'body', fontSize: 24 },
})
const blob = await createDocx({ styles })
.p('Hello', { className: 'title' }).toBlob()Common causes
- Self inheritance or a cycle across multiple style classes.
Diagnostic fields
code:STYLE_CIRCULAR_EXTENDSdiagnosticCode:DOCXKIT_STYLE_CIRCULAR_EXTENDSname:DocxKitErrordocs: https://docx-kit.ntnyq.dev/errors/docxkit_style_circular_extends/
Example message
text
Circular extends detected for style class "body". Chain: body → title → body