Skip to content

DOCXKIT_STYLE_CIRCULAR_EXTENDS: Circular style inheritance ​

The extends chain references a style that is already being resolved.

What to do ​

  1. Follow the chain shown in the message.
  2. 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 ​

Example message ​

text
Circular extends detected for style class "body". Chain: body → title → body

Released under the MIT License.