Skip to content

🎥 Make videos programmatically with React

fix type

Jonny Burger71b1c3b6c333
diff --git a/packages/create-video/src/templates.tsx b/packages/create-video/src/templates.tsx
index fa1678cbd1..876cf54bdc 100644
--- a/packages/create-video/src/templates.tsx
+++ b/packages/create-video/src/templates.tsx
@@ -17,7 +17,6 @@ type DynamicTemplate =
height: number;
};
};
-
export type Template = {
shortName: string;
description: string;
@@ -41,8 +40,34 @@ export type Template = {
defaultBranch: string;
} & DynamicTemplate;
+type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;
+
+function truthy<T>(value: T): value is Truthy<T> {
+ return Boolean(value);
+}
+
const ENABLE_NEXT = false;
+const nextTemplate: Template = {
+ homePageLabel: 'Next.js',
+ shortName: 'Next.js',
+ org: 'remotion-dev',
+ repoName: 'template-next',
+ description: 'SaaS template for video generation apps',
+ longerDescription:
+ 'A software-as-a-service starter kit which has the Remotion Player and rendering via Remotion Lambda built-in. Our recommended choice for people who want to build a video generation app.',
+ promoBanner: {
+ width: 1280,
+ height: 720,
+ // TODO: Update this image
+ src: '/img/remix-template.png',
+ },
+ cliId: 'next',
+ type: 'image',
+ defaultBranch: 'main',
+};
+
+// Note that this page is statically analyzed by extract-articles.mjs
export const FEATURED_TEMPLATES: Template[] = [
{
homePageLabel: 'Hello World',
@@ -57,30 +82,11 @@ export const FEATURED_TEMPLATES: Template[] = [
height: 1080,
width: 1920,
},
- cliId: 'hello-world',
- type: 'video',
+ cliId: 'hello-world' as const,
+ type: 'video' as const,
defaultBranch: 'main',
},
- ENABLE_NEXT
- ? {
- homePageLabel: 'Next.js',
- shortName: 'Next.js',
- org: 'remotion-dev',
- repoName: 'template-next',
- description: 'SaaS template for video generation apps',
- longerDescription:
- 'A software-as-a-service starter kit which has the Remotion Player and rendering via Remotion Lambda built-in. Our recommended choice for people who want to build a video generation app.',
- promoBanner: {
- width: 1280,
- height: 720,
- // TODO: Update this image
- src: '/img/remix-template.png',
- },
- cliId: 'next',
- type: 'image',
- defaultBranch: 'main',
- }
- : null,
+ ENABLE_NEXT ? nextTemplate : null,
{
homePageLabel: 'Blank',
shortName: 'Blank',
@@ -94,8 +100,8 @@ export const FEATURED_TEMPLATES: Template[] = [
width: 1280,
height: 720,
},
- cliId: 'blank',
- type: 'video',
+ cliId: 'blank' as const,
+ type: 'video' as const,
defaultBranch: 'main',
},
{
@@ -111,8 +117,8 @@ export const FEATURED_TEMPLATES: Template[] = [
width: 1920,
height: 1080,
},
- cliId: 'javascript',
- type: 'video',
+ cliId: 'javascript' as const,
+ type: 'video' as const,
defaultBranch: 'main',
},
{
@@ -128,8 +134,8 @@ export const FEATURED_TEMPLATES: Template[] = [
height: 720,
src: '/img/remix-template.png',
},
- cliId: 'remix',
- type: 'image',
+ cliId: 'remix' as const,
+ type: 'image' as const,
defaultBranch: 'main',
},
{
@@ -145,8 +151,8 @@ export const FEATURED_TEMPLATES: Template[] = [
width: 1280,
height: 720,
},
- cliId: 'three',
- type: 'video',
+ cliId: 'three' as const,
+ type: 'video' as const,
defaultBranch: 'main',
},
{
@@ -162,8 +168,8 @@ export const FEATURED_TEMPLATES: Template[] = [
height: 628,
width: 1200,
},
- cliId: 'still',
- type: 'video',
+ cliId: 'still' as const,
+ type: 'video' as const,
defaultBranch: 'main',
},
{
@@ -179,8 +185,8 @@ export const FEATURED_TEMPLATES: Template[] = [
width: 1920,
height: 1080,
},
- cliId: 'tts',
- type: 'video',
+ cliId: 'tts' as const,
+ type: 'video' as const,
defaultBranch: 'master',
},
{
@@ -196,8 +202,8 @@ export const FEATURED_TEMPLATES: Template[] = [
height: 1080,
width: 1080,
},
- cliId: 'audiogram',
- type: 'video',
+ cliId: 'audiogram' as const,
+ type: 'video' as const,
defaultBranch: 'main',
},
{
@@ -212,8 +218,8 @@ export const FEATURED_TEMPLATES: Template[] = [
height: 1080,
width: 1920,
},
- cliId: 'skia',
- type: 'video',
+ cliId: 'skia' as const,
+ type: 'video' as const,
defaultBranch: 'main',
},
{
@@ -229,8 +235,8 @@ export const FEATURED_TEMPLATES: Template[] = [
height: 720,
width: 1280,
},
- cliId: 'tailwind',
- type: 'video',
+ cliId: 'tailwind' as const,
+ type: 'video' as const,
defaultBranch: 'main',
},
@@ -252,8 +258,8 @@ export const FEATURED_TEMPLATES: Template[] = [
height: 720,
width: 1280,
},
- cliId: 'overlay',
- type: 'video',
+ cliId: 'overlay' as const,
+ type: 'video' as const,
defaultBranch: 'main',
},
-].filter(Boolean);
+].filter(truthy);