From cd5fdd4924f103604afcea25f3c89ae358c373c7 Mon Sep 17 00:00:00 2001 From: Lucas Garcez Date: Mon, 5 Feb 2024 22:37:42 +1100 Subject: [PATCH] fix: Properly type Format `Templates` (#2499) add PredefinedTemplates type --- package/src/devices/Templates.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/package/src/devices/Templates.ts b/package/src/devices/Templates.ts index 3a1df24..274c419 100644 --- a/package/src/devices/Templates.ts +++ b/package/src/devices/Templates.ts @@ -1,9 +1,17 @@ import { Dimensions } from 'react-native' import { FormatFilter } from './getCameraFormat' -type TTemplates = { - [key: string]: FormatFilter[] -} +type PredefinedTemplates = + | 'Video' + | 'Video60Fps' + | 'VideoSlowMotion' + | 'VideoStabilized' + | 'Photo' + | 'PhotoPortrait' + | 'FrameProcessingYUV' + | 'FrameProcessingRGB' + | 'Snapchat' + | 'Instagram' const SnapchatResolution = { width: 1920, height: 1080 } const InstagramResolution = { width: 3840, height: 2160 } @@ -16,7 +24,7 @@ const ScreenAspectRatio = Dimensions.get('window').height / Dimensions.get('wind * const format = useCameraFormat(device, Templates.Snapchat) * ``` */ -export const Templates: TTemplates = { +export const Templates: Record = { /** * Highest resolution video recordings (e.g. 4k) */