remotion-dev/remotion · error · TypeError

translate() supports only the following signatures: translat

Error message

translate() supports only the following signatures:
translate(x: LengthPercentageUnitString)
translate(x: number)
translate(x: number, y: number)
translate(translation: number, unit: LengthPercentageUnit)
translate(x: number, unitX: LengthPercentageUnit, y: number, unitY: LengthPercentageUnit): string;

What it means

`translate()` accepts only 1, 2, or 4 arguments in specific type combinations (length/percentage unit string, number, or number+unit pairs). Any other arity (0, 3, 5+) or a type combo that fits no case (e.g. a number paired with a non-unit string, or a string that is not a length/percentage unit) falls through to this exhaustive signature list. The message lists every accepted signature.

Source

Thrown at packages/animation-utils/src/transformation-helpers/make-transform/transform-functions.ts:406

		}

		// Case D
		if (typeof arg1 === 'number' && typeof arg2 !== 'number') {
			checkNumber({num: arg1, param: 'x', api: 'translate'});
			return `translate(${arg1}${arg2})`;
		}
	}

	if (arguments.length === 4) {
		// Case E
		if (typeof arg1 === 'number' && typeof arg3 === 'number') {
			checkNumber({num: arg1, param: 'x', api: 'translate'});
			checkNumber({num: arg3, param: 'y', api: 'translate'});
			return `translate(${arg1}${arg2}, ${arg3}${arg4})`;
		}
	}

	throw new TypeError(
		[
			`translate() supports only the following signatures:`,
			`translate(x: LengthPercentageUnitString)`,
			`translate(x: number)`,
			`translate(x: number, y: number)`,
			`translate(translation: number, unit: LengthPercentageUnit)`,
			`translate(x: number, unitX: LengthPercentageUnit, y: number, unitY: LengthPercentageUnit): string;`,
		].join('\n'),
	);
}

function translate3d(
	x: LengthPercentageUnitString | number,
	y: LengthPercentageUnitString | number,
	z: LengthPercentageUnitString | number,
): string;
function translate3d(
	x: number,

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Match your call to a listed signature: `translate('50px')`, `translate(50)`, `translate(50, 20)`, `translate(50, 'px')`, or `translate(50, 'px', 20, 'px')`.
  2. Use only length (`px`, `em`, etc.) or percentage (`%`) units, not angle units.
  3. Check `arguments.length` is 1, 2, or 4 when building calls dynamically.
  4. Drop `as any` so the overload list guides the call at compile time.

Example fix

// before
const t = translate(50, 'deg'); // deg is not a length unit

// after
const t = translate(50, 'px');
Defensive patterns

Strategy: validation

Validate before calling

// Validate translate() arguments match a supported signature before calling.
const LENGTH_UNITS = ['px', 'em', 'rem', 'vw', 'vh', '%'] as const;
type LengthUnit = (typeof LENGTH_UNITS)[number];

const isLengthUnitString = (v: unknown): v is string => {
  if (typeof v !== 'string') return false;
  return LENGTH_UNITS.some((u) => {
    if (!v.endsWith(u)) return false;
    return Number.isFinite(Number(v.slice(0, v.length - u.length)));
  });
};
// Prefer calling a fixed overload: translate('50px'), translate(50), translate(50,20).

Type guard

const isLengthUnit = (v: unknown): v is LengthUnit =>
    typeof v === 'string' && (LENGTH_UNITS as readonly string[]).includes(v);

const isLengthUnitString = (v: unknown): v is string => {
  if (typeof v !== 'string') return false;
  return LENGTH_UNITS.some((u) =>
    v.endsWith(u) && Number.isFinite(Number(v.slice(0, v.length - u.length))),
  );
};

Prevention

When it happens

Trigger: Calling `translate()` with no args; `translate(1, 2, 3)` (3 args); `translate('50gr')` (not a length/percentage unit); `translate(10, 'deg')` (deg is not a length/percentage unit); `translate(10, 'px', 20)` (wrong arity for the 4-arg form).

Common situations: Passing angle units (`deg`) into translate; passing a plain string that does not include a recognized unit suffix; variable-length argument arrays with the wrong count; confusing the 2-arg number form `translate(x, y)` with the number+unit form `translate(x, unit)`.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/640a1f6cb6bc747d. Report an issue: GitHub.