{"record":{"id":"4430030823cb74dd","repo":"remotion-dev/remotion","slug":"translate3d-supports-only-the-following-signatur","errorCode":null,"errorMessage":"translate3d() supports only the following signatures:\ntranslate3d(x: LengthPercentageUnitString, y: LengthPercentageUnitString, z: LengthPercentageUnitString)\ntranslate3d(x: number, unitX: LengthPercentageUnit, y: number, unitY: LengthPercentageUnit, z: number, unitZ: LengthUnit)","messagePattern":"translate3d\\(\\) supports only the following signatures:\ntranslate3d\\(x: LengthPercentageUnitString, y: LengthPercentageUnitString, z: LengthPercentageUnitString\\)\ntranslate3d\\(x: number, unitX: LengthPercentageUnit, y: number, unitY: LengthPercentageUnit, z: number, unitZ: LengthUnit\\)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/animation-utils/src/transformation-helpers/make-transform/transform-functions.ts","lineNumber":468,"sourceCode":"\n\t\treturn `translate3d(${vars.join(', ')})`;\n\t}\n\n\tif (arguments.length === 6) {\n\t\tconst [x, unitX, y, unitY, z, unitZ] = args;\n\t\tif (\n\t\t\ttypeof x === 'number' &&\n\t\t\ttypeof y === 'number' &&\n\t\t\ttypeof z === 'number'\n\t\t) {\n\t\t\tcheckNumber({num: x, param: 'x', api: 'translate3d'});\n\t\t\tcheckNumber({num: y, param: 'y', api: 'translate3d'});\n\t\t\tcheckNumber({num: z, param: 'z', api: 'translate3d'});\n\t\t\treturn `translate3d(${x}${unitX}, ${y}${unitY}, ${z}${unitZ})`;\n\t\t}\n\t}\n\n\tthrow new TypeError(\n\t\t[\n\t\t\t`translate3d() supports only the following signatures:`,\n\t\t\t`translate3d(x: LengthPercentageUnitString, y: LengthPercentageUnitString, z: LengthPercentageUnitString)`,\n\t\t\t`translate3d(x: number, unitX: LengthPercentageUnit, y: number, unitY: LengthPercentageUnit, z: number, unitZ: LengthUnit)`,\n\t\t].join('\\n'),\n\t);\n}\n\nfunction translateX(x: LengthPercentageUnitString): string;\nfunction translateX(x: number, unit?: LengthPercentageUnit): string;\nfunction translateX(x: unknown, unit: LengthPercentageUnit = 'px'): string {\n\tif (isUnitWithString(x, lengthPercentageUnits)) {\n\t\treturn `translateX(${x})`;\n\t}\n\n\tcheckNumber({num: x, param: 'x', api: 'translateX'});\n\n\treturn `translateX(${x}${unit})`;","sourceCodeStart":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/animation-utils/src/transformation-helpers/make-transform/transform-functions.ts#L450-L486","documentation":"`translate3d()` accepts only exactly 3 arguments (all length/percentage-or-number, x/y use LengthPercentageUnit, z uses LengthUnit) or exactly 6 arguments (three number/unit pairs). Any other arity (0, 1, 2, 4, 5, 7+) or a 6-arg call where x/y/z are not all numbers falls through to this exhaustive signature list.","triggerScenarios":"Calling `translate3d(10, 20)` (2 args); `translate3d('10px', '20px')` (2 args); `translate3d(10, 'px', 20, 'px', 30)` (5 args); `translate3d(10, 'px', 20, 'px', '30', 'px')` (third value is a string, not a number, in the 6-arg form); `translate3d()` with no args.","commonSituations":"Forgetting the z component (treating translate3d like translate); mixing the 3-arg and 6-arg forms; passing unit strings inconsistently across the three axes; building calls from arrays of differing lengths.","solutions":["Use the 3-arg form with unit strings or numbers: `translate3d('10px', '20px', '5px')` or `translate3d(10, 20, 5)`.","Or use the 6-arg form with three number/unit pairs: `translate3d(10, 'px', 20, 'px', 30, 'px')`.","Ensure all three axes are provided; if you only need x/y, use `translate` instead.","Drop `as any` so the overload signatures enforce correct arity."],"exampleFix":"// before\nconst t = translate3d(10, 20); // missing z\n\n// after\nconst t = translate3d(10, 20, 0);","handlingStrategy":"validation","validationCode":"// Validate translate3d() arity/types before calling.\nconst isLengthNumberOrString = (v: unknown): boolean =>\n  typeof v === 'number' ||\n  (typeof v === 'string' && Number.isFinite(Number(v.replace(/[a-z%]+$/i, ''))));\n\n// Rule of thumb: pass exactly 3 args (numbers or unit strings) or exactly 6 (number/unit pairs).\nif (![3, 6].includes(args.length)) throw new Error('translate3d needs 3 or 6 args');","typeGuard":"const isTranslate3dShortForm = (\n  args: unknown[],\n): args is [string | number, string | number, string | number] =>\n  args.length === 3 && args.every((a) => typeof a === 'number' || typeof a === 'string');\n\nconst isTranslate3dLongForm = (\n  args: unknown[],\n): args is [number, string, number, string, number, string] =>\n  args.length === 6 &&\n  [0, 2, 4].every((i) => typeof args[i] === 'number') &&\n  [1, 3, 5].every((i) => typeof args[i] === 'string');","tryCatchPattern":null,"preventionTips":["Always provide all three (x, y, z) components to translate3d.","Use the 3-arg form (`translate3d(10, 20, 0)`) unless you need mixed units, then use the 6-arg form.","If you only need x/y translation, use `translate` instead of `translate3d`.","Drop `as any` so the overload list enforces arity."],"tags":["transform","translate3d","validation","runtime","overload"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}