# Shims

Converts between Mixins and Aspects.

Since Mixins and Aspects are both implementations of the visitor pattern,
they can be converted from each other. Mixins are applied immediately (imperative),
while Aspects are applied during synthesis (declarative).

- Source: [`core/lib/mixins/shims.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/core/lib/mixins/shims.ts#L11)
- Type last changed: v2.244.0 · 19 Mar 2026

## Methods

- `asAspect(mixin: IMixin): IAspect` (static) — Wraps a Mixin as an Aspect.

  The resulting Aspect defers the Mixin's application to the synthesis phase.
  The Mixin's `supports()` method is used to filter which constructs are visited.

  **Parameters**

  - `mixin` — The Mixin to wrap.

- `asMixin(aspect: IAspect): IMixin` (static) — Wraps an Aspect as a Mixin.

  The resulting Mixin applies the Aspect's `visit()` immediately to every node.
  The Aspect is applied to all constructs since Aspects don't have a `supports()` filter.

  **Parameters**

  - `aspect` — The Aspect to wrap.
