{"record":{"id":"0a24c11fde47ec35","repo":"remotion-dev/remotion","slug":"type-of-trimafter-prop-must-be-a-number-instead-g","errorCode":null,"errorMessage":"type of trimAfter prop must be a number, instead got type ${typeof trimAfter}.","messagePattern":"type of trimAfter prop must be a number, instead got type (.+?)\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/validate-start-from-props.ts","lineNumber":70,"sourceCode":"\t\t\tthrow new TypeError(\n\t\t\t\t`type of trimBefore prop must be a number, instead got type ${typeof trimBefore}.`,\n\t\t\t);\n\t\t}\n\n\t\tif (isNaN(trimBefore) || trimBefore === Infinity) {\n\t\t\tthrow new TypeError('trimBefore prop can not be NaN or Infinity.');\n\t\t}\n\n\t\tif (trimBefore < 0) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`trimBefore must be greater than equal to 0 instead got ${trimBefore}.`,\n\t\t\t);\n\t\t}\n\t}\n\n\tif (typeof trimAfter !== 'undefined') {\n\t\tif (typeof trimAfter !== 'number') {\n\t\t\tthrow new TypeError(\n\t\t\t\t`type of trimAfter prop must be a number, instead got type ${typeof trimAfter}.`,\n\t\t\t);\n\t\t}\n\n\t\tif (isNaN(trimAfter)) {\n\t\t\tthrow new TypeError('trimAfter prop can not be NaN.');\n\t\t}\n\n\t\tif (trimAfter <= 0) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`trimAfter must be a positive number, instead got ${trimAfter}.`,\n\t\t\t);\n\t\t}\n\t}\n\n\tif ((trimAfter as number) <= (trimBefore as number)) {\n\t\tthrow new TypeError('trimAfter prop must be greater than trimBefore prop.');\n\t}","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/validate-start-from-props.ts#L52-L88","documentation":"The `trimAfter` prop (the non-deprecated replacement for endAt) on media components must be a number representing the frame at which playback stops. validateTrimProps checks the runtime type because values destructured from props, configs, or JSON may arrive as strings rather than numbers.","triggerScenarios":"Passing trimAfter as a string (trimAfter=\"200\"), an object, or any non-number non-undefined value to a media component.","commonSituations":"Reading trimAfter from a JSON scene descriptor or CMS where numbers are serialized as strings; passing a value from URL query params without conversion.","solutions":["Pass trimAfter as a numeric literal: trimAfter={200}.","If the value is a string, parse and validate it: trimAfter={Number(myStr)} after a finiteness check.","Omit the prop if you do not need to cap the end."],"exampleFix":"// before\n<Audio src={src} trimAfter=\"180\" />\n// after\n<Audio src={src} trimAfter={180} />","handlingStrategy":"type-guard","validationCode":"if (trimAfter !== undefined && typeof trimAfter !== 'number') {\n  throw new Error('trimAfter must be a number or undefined');\n}","typeGuard":"const isTrimAfter = (v: unknown): v is number | undefined =>\n  v === undefined || typeof v === 'number';","tryCatchPattern":null,"preventionTips":["Type the prop as number | undefined in wrapper components.","Parse string sources with Number() and validate before passing.","Keep scene/config descriptors typed so numbers are not serialized as strings."],"tags":["validation","props","trimming","typeerror"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}