Skip to content

Commit

Permalink
fix: set all default return-data to be unknown instead of undefined
Browse files Browse the repository at this point in the history
As suggested by @ianshade, for a better dev experience
  • Loading branch information
nytamin committed Sep 27, 2023
1 parent 5121dc1 commit 7622c14
Showing 1 changed file with 78 additions and 90 deletions.
168 changes: 78 additions & 90 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,91 +192,79 @@ export interface TypedResponseCommand<CommandName extends Commands, Params, Retu
export type CReturnType<C extends Commands> = AllTypedCommands[C]['returnType']

export interface AllTypedCommands {
[Commands.Loadbg]: TypedResponseCommand<Commands.Loadbg, LoadbgParameters, undefined>
[Commands.LoadbgDecklink]: TypedResponseCommand<Commands.LoadbgDecklink, LoadbgDecklinkParameters, undefined>
[Commands.LoadbgHtml]: TypedResponseCommand<Commands.LoadbgHtml, LoadbgHtmlParameters, undefined>
[Commands.LoadbgRoute]: TypedResponseCommand<Commands.LoadbgRoute, LoadbgRouteParameters, undefined>
[Commands.Load]: TypedResponseCommand<Commands.Load, LoadParameters, undefined>
[Commands.Play]: TypedResponseCommand<Commands.Play, PlayParameters, undefined>
[Commands.PlayDecklink]: TypedResponseCommand<Commands.PlayDecklink, PlayDecklinkParameters, undefined>
[Commands.PlayHtml]: TypedResponseCommand<Commands.PlayHtml, PlayHtmlParameters, undefined>
[Commands.PlayRoute]: TypedResponseCommand<Commands.PlayRoute, PlayRouteParameters, undefined>
[Commands.Pause]: TypedResponseCommand<Commands.Pause, PauseParameters, undefined>
[Commands.Resume]: TypedResponseCommand<Commands.Resume, ResumeParameters, undefined>
[Commands.Stop]: TypedResponseCommand<Commands.Stop, StopParameters, undefined>
[Commands.Clear]: TypedResponseCommand<Commands.Clear, ClearParameters, undefined>
[Commands.Call]: TypedResponseCommand<Commands.Call, CallParameters, undefined>
[Commands.Swap]: TypedResponseCommand<Commands.Swap, SwapParameters, undefined>
[Commands.Add]: TypedResponseCommand<Commands.Add, AddParameters, undefined>
[Commands.Remove]: TypedResponseCommand<Commands.Remove, RemoveParameters, undefined>
[Commands.Print]: TypedResponseCommand<Commands.Print, PrintParameters, undefined>
[Commands.LogLevel]: TypedResponseCommand<Commands.LogLevel, LogLevelParameters, undefined>
[Commands.LogCategory]: TypedResponseCommand<Commands.LogCategory, LogCategoryParameters, undefined>
[Commands.Set]: TypedResponseCommand<Commands.Set, SetParameters, undefined>
[Commands.Lock]: TypedResponseCommand<Commands.Lock, LockParameters, undefined>
[Commands.DataStore]: TypedResponseCommand<Commands.DataStore, DataStoreParameters, undefined>
[Commands.DataRetrieve]: TypedResponseCommand<Commands.DataRetrieve, DataRetrieveParameters, undefined>
[Commands.DataList]: TypedResponseCommand<Commands.DataList, DataListParameters, undefined>
[Commands.DataRemove]: TypedResponseCommand<Commands.DataRemove, DataRemoveParameters, undefined>
[Commands.CgAdd]: TypedResponseCommand<Commands.CgAdd, CgAddParameters, undefined>
[Commands.CgPlay]: TypedResponseCommand<Commands.CgPlay, CgPlayParameters, undefined>
[Commands.CgStop]: TypedResponseCommand<Commands.CgStop, CgStopParameters, undefined>
[Commands.CgNext]: TypedResponseCommand<Commands.CgNext, CgNextParameters, undefined>
[Commands.CgRemove]: TypedResponseCommand<Commands.CgRemove, CgRemoveParameters, undefined>
[Commands.CgClear]: TypedResponseCommand<Commands.CgClear, CgClearParameters, undefined>
[Commands.CgUpdate]: TypedResponseCommand<Commands.CgUpdate, CgUpdateParameters, undefined>
[Commands.CgInvoke]: TypedResponseCommand<Commands.CgInvoke, CgInvokeParameters, undefined>
[Commands.CgInfo]: TypedResponseCommand<Commands.CgInfo, CgInfoParameters, undefined>
[Commands.MixerKeyer]: TypedResponseCommand<Commands.MixerKeyer, MixerKeyerParameters, undefined>
[Commands.MixerChroma]: TypedResponseCommand<Commands.MixerChroma, MixerChromaParameters, undefined>
[Commands.MixerBlend]: TypedResponseCommand<Commands.MixerBlend, MixerBlendParameters, undefined>
[Commands.MixerInvert]: TypedResponseCommand<Commands.MixerInvert, MixerInvertParameters, undefined>
[Commands.MixerOpacity]: TypedResponseCommand<Commands.MixerOpacity, MixerOpacityParameters, undefined>
[Commands.MixerBrightness]: TypedResponseCommand<Commands.MixerBrightness, MixerBrightnessParameters, undefined>
[Commands.MixerSaturation]: TypedResponseCommand<Commands.MixerSaturation, MixerSaturationParameters, undefined>
[Commands.MixerContrast]: TypedResponseCommand<Commands.MixerContrast, MixerContrastParameters, undefined>
[Commands.MixerLevels]: TypedResponseCommand<Commands.MixerLevels, MixerLevelsParameters, undefined>
[Commands.MixerFill]: TypedResponseCommand<Commands.MixerFill, MixerFillParameters, undefined>
[Commands.MixerClip]: TypedResponseCommand<Commands.MixerClip, MixerClipParameters, undefined>
[Commands.MixerAnchor]: TypedResponseCommand<Commands.MixerAnchor, MixerAnchorParameters, undefined>
[Commands.MixerCrop]: TypedResponseCommand<Commands.MixerCrop, MixerCropParameters, undefined>
[Commands.MixerRotation]: TypedResponseCommand<Commands.MixerRotation, MixerRotationParameters, undefined>
[Commands.MixerPerspective]: TypedResponseCommand<Commands.MixerPerspective, MixerPerspectiveParameters, undefined>
[Commands.MixerMipmap]: TypedResponseCommand<Commands.MixerMipmap, MixerMipmapParameters, undefined>
[Commands.MixerVolume]: TypedResponseCommand<Commands.MixerVolume, MixerVolumeParameters, undefined>
[Commands.MixerMastervolume]: TypedResponseCommand<
Commands.MixerMastervolume,
MixerMastervolumeParameters,
undefined
>
[Commands.Loadbg]: TypedResponseCommand<Commands.Loadbg, LoadbgParameters, unknown>
[Commands.LoadbgDecklink]: TypedResponseCommand<Commands.LoadbgDecklink, LoadbgDecklinkParameters, unknown>
[Commands.LoadbgHtml]: TypedResponseCommand<Commands.LoadbgHtml, LoadbgHtmlParameters, unknown>
[Commands.LoadbgRoute]: TypedResponseCommand<Commands.LoadbgRoute, LoadbgRouteParameters, unknown>
[Commands.Load]: TypedResponseCommand<Commands.Load, LoadParameters, unknown>
[Commands.Play]: TypedResponseCommand<Commands.Play, PlayParameters, unknown>
[Commands.PlayDecklink]: TypedResponseCommand<Commands.PlayDecklink, PlayDecklinkParameters, unknown>
[Commands.PlayHtml]: TypedResponseCommand<Commands.PlayHtml, PlayHtmlParameters, unknown>
[Commands.PlayRoute]: TypedResponseCommand<Commands.PlayRoute, PlayRouteParameters, unknown>
[Commands.Pause]: TypedResponseCommand<Commands.Pause, PauseParameters, unknown>
[Commands.Resume]: TypedResponseCommand<Commands.Resume, ResumeParameters, unknown>
[Commands.Stop]: TypedResponseCommand<Commands.Stop, StopParameters, unknown>
[Commands.Clear]: TypedResponseCommand<Commands.Clear, ClearParameters, unknown>
[Commands.Call]: TypedResponseCommand<Commands.Call, CallParameters, unknown>
[Commands.Swap]: TypedResponseCommand<Commands.Swap, SwapParameters, unknown>
[Commands.Add]: TypedResponseCommand<Commands.Add, AddParameters, unknown>
[Commands.Remove]: TypedResponseCommand<Commands.Remove, RemoveParameters, unknown>
[Commands.Print]: TypedResponseCommand<Commands.Print, PrintParameters, unknown>
[Commands.LogLevel]: TypedResponseCommand<Commands.LogLevel, LogLevelParameters, unknown>
[Commands.LogCategory]: TypedResponseCommand<Commands.LogCategory, LogCategoryParameters, unknown>
[Commands.Set]: TypedResponseCommand<Commands.Set, SetParameters, unknown>
[Commands.Lock]: TypedResponseCommand<Commands.Lock, LockParameters, unknown>
[Commands.DataStore]: TypedResponseCommand<Commands.DataStore, DataStoreParameters, unknown>
[Commands.DataRetrieve]: TypedResponseCommand<Commands.DataRetrieve, DataRetrieveParameters, unknown>
[Commands.DataList]: TypedResponseCommand<Commands.DataList, DataListParameters, unknown>
[Commands.DataRemove]: TypedResponseCommand<Commands.DataRemove, DataRemoveParameters, unknown>
[Commands.CgAdd]: TypedResponseCommand<Commands.CgAdd, CgAddParameters, unknown>
[Commands.CgPlay]: TypedResponseCommand<Commands.CgPlay, CgPlayParameters, unknown>
[Commands.CgStop]: TypedResponseCommand<Commands.CgStop, CgStopParameters, unknown>
[Commands.CgNext]: TypedResponseCommand<Commands.CgNext, CgNextParameters, unknown>
[Commands.CgRemove]: TypedResponseCommand<Commands.CgRemove, CgRemoveParameters, unknown>
[Commands.CgClear]: TypedResponseCommand<Commands.CgClear, CgClearParameters, unknown>
[Commands.CgUpdate]: TypedResponseCommand<Commands.CgUpdate, CgUpdateParameters, unknown>
[Commands.CgInvoke]: TypedResponseCommand<Commands.CgInvoke, CgInvokeParameters, unknown>
[Commands.CgInfo]: TypedResponseCommand<Commands.CgInfo, CgInfoParameters, unknown>
[Commands.MixerKeyer]: TypedResponseCommand<Commands.MixerKeyer, MixerKeyerParameters, unknown>
[Commands.MixerChroma]: TypedResponseCommand<Commands.MixerChroma, MixerChromaParameters, unknown>
[Commands.MixerBlend]: TypedResponseCommand<Commands.MixerBlend, MixerBlendParameters, unknown>
[Commands.MixerInvert]: TypedResponseCommand<Commands.MixerInvert, MixerInvertParameters, unknown>
[Commands.MixerOpacity]: TypedResponseCommand<Commands.MixerOpacity, MixerOpacityParameters, unknown>
[Commands.MixerBrightness]: TypedResponseCommand<Commands.MixerBrightness, MixerBrightnessParameters, unknown>
[Commands.MixerSaturation]: TypedResponseCommand<Commands.MixerSaturation, MixerSaturationParameters, unknown>
[Commands.MixerContrast]: TypedResponseCommand<Commands.MixerContrast, MixerContrastParameters, unknown>
[Commands.MixerLevels]: TypedResponseCommand<Commands.MixerLevels, MixerLevelsParameters, unknown>
[Commands.MixerFill]: TypedResponseCommand<Commands.MixerFill, MixerFillParameters, unknown>
[Commands.MixerClip]: TypedResponseCommand<Commands.MixerClip, MixerClipParameters, unknown>
[Commands.MixerAnchor]: TypedResponseCommand<Commands.MixerAnchor, MixerAnchorParameters, unknown>
[Commands.MixerCrop]: TypedResponseCommand<Commands.MixerCrop, MixerCropParameters, unknown>
[Commands.MixerRotation]: TypedResponseCommand<Commands.MixerRotation, MixerRotationParameters, unknown>
[Commands.MixerPerspective]: TypedResponseCommand<Commands.MixerPerspective, MixerPerspectiveParameters, unknown>
[Commands.MixerMipmap]: TypedResponseCommand<Commands.MixerMipmap, MixerMipmapParameters, unknown>
[Commands.MixerVolume]: TypedResponseCommand<Commands.MixerVolume, MixerVolumeParameters, unknown>
[Commands.MixerMastervolume]: TypedResponseCommand<Commands.MixerMastervolume, MixerMastervolumeParameters, unknown>
[Commands.MixerStraightAlphaOutput]: TypedResponseCommand<
Commands.MixerStraightAlphaOutput,
MixerStraightAlphaOutputParameters,
undefined
>
[Commands.MixerGrid]: TypedResponseCommand<Commands.MixerGrid, MixerGridParameters, undefined>
[Commands.MixerCommit]: TypedResponseCommand<Commands.MixerCommit, MixerCommitParameters, undefined>
[Commands.MixerClear]: TypedResponseCommand<Commands.MixerClear, MixerClearParameters, undefined>
[Commands.ChannelGrid]: TypedResponseCommand<Commands.ChannelGrid, ChannelGridParameters, undefined>
[Commands.ThumbnailList]: TypedResponseCommand<Commands.ThumbnailList, ThumbnailListParameters, undefined>
[Commands.ThumbnailRetrieve]: TypedResponseCommand<
Commands.ThumbnailRetrieve,
ThumbnailRetrieveParameters,
undefined
>
[Commands.ThumbnailGenerate]: TypedResponseCommand<
Commands.ThumbnailGenerate,
ThumbnailGenerateParameters,
undefined
unknown
>
[Commands.MixerGrid]: TypedResponseCommand<Commands.MixerGrid, MixerGridParameters, unknown>
[Commands.MixerCommit]: TypedResponseCommand<Commands.MixerCommit, MixerCommitParameters, unknown>
[Commands.MixerClear]: TypedResponseCommand<Commands.MixerClear, MixerClearParameters, unknown>
[Commands.ChannelGrid]: TypedResponseCommand<Commands.ChannelGrid, ChannelGridParameters, unknown>
[Commands.ThumbnailList]: TypedResponseCommand<Commands.ThumbnailList, ThumbnailListParameters, unknown>
[Commands.ThumbnailRetrieve]: TypedResponseCommand<Commands.ThumbnailRetrieve, ThumbnailRetrieveParameters, unknown>
[Commands.ThumbnailGenerate]: TypedResponseCommand<Commands.ThumbnailGenerate, ThumbnailGenerateParameters, unknown>
[Commands.ThumbnailGenerateAll]: TypedResponseCommand<
Commands.ThumbnailGenerateAll,
ThumbnailGenerateAllParameters,
undefined
unknown
>
[Commands.Cinf]: TypedResponseCommand<Commands.Cinf, CinfParameters, ClipInfo | undefined>
[Commands.Cinf]: TypedResponseCommand<Commands.Cinf, CinfParameters, ClipInfo | unknown>
[Commands.Cls]: TypedResponseCommand<Commands.Cls, ClsParameters, ClipInfo[]>
[Commands.Fls]: TypedResponseCommand<Commands.Fls, FlsParameters, undefined>
[Commands.Fls]: TypedResponseCommand<Commands.Fls, FlsParameters, unknown>
[Commands.Tls]: TypedResponseCommand<Commands.Tls, TlsParameters, string[]>
[Commands.Version]: TypedResponseCommand<Commands.Version, VersionParameters, VersionInfo>
[Commands.Info]: TypedResponseCommand<Commands.Info, InfoParameters, InfoEntry[]>
Expand All @@ -286,20 +274,20 @@ export interface AllTypedCommands {
InfoChannelEntry | undefined
>
[Commands.InfoLayer]: TypedResponseCommand<Commands.InfoLayer, InfoLayerParameters, InfoLayerEntry | undefined>
[Commands.InfoTemplate]: TypedResponseCommand<Commands.InfoTemplate, InfoTemplateParameters, undefined>
[Commands.InfoConfig]: TypedResponseCommand<Commands.InfoConfig, InfoConfigParameters, undefined>
[Commands.InfoPaths]: TypedResponseCommand<Commands.InfoPaths, InfoPathsParameters, undefined>
[Commands.InfoSystem]: TypedResponseCommand<Commands.InfoSystem, InfoSystemParameters, undefined>
[Commands.InfoServer]: TypedResponseCommand<Commands.InfoServer, InfoServerParameters, undefined>
[Commands.InfoQueues]: TypedResponseCommand<Commands.InfoQueues, InfoQueuesParameters, undefined>
[Commands.InfoThreads]: TypedResponseCommand<Commands.InfoThreads, InfoThreadsParameters, undefined>
[Commands.InfoDelay]: TypedResponseCommand<Commands.InfoDelay, InfoDelayParameters, undefined>
[Commands.Diag]: TypedResponseCommand<Commands.Diag, DiagParameters, undefined>
[Commands.GlInfo]: TypedResponseCommand<Commands.GlInfo, GlInfoParameters, undefined>
[Commands.GlGc]: TypedResponseCommand<Commands.GlGc, GlGcParameters, undefined>
[Commands.Bye]: TypedResponseCommand<Commands.Bye, ByeParameters, undefined>
[Commands.Kill]: TypedResponseCommand<Commands.Kill, KillParameters, undefined>
[Commands.Restart]: TypedResponseCommand<Commands.Restart, RestartParameters, undefined>
[Commands.InfoTemplate]: TypedResponseCommand<Commands.InfoTemplate, InfoTemplateParameters, unknown>
[Commands.InfoConfig]: TypedResponseCommand<Commands.InfoConfig, InfoConfigParameters, unknown>
[Commands.InfoPaths]: TypedResponseCommand<Commands.InfoPaths, InfoPathsParameters, unknown>
[Commands.InfoSystem]: TypedResponseCommand<Commands.InfoSystem, InfoSystemParameters, unknown>
[Commands.InfoServer]: TypedResponseCommand<Commands.InfoServer, InfoServerParameters, unknown>
[Commands.InfoQueues]: TypedResponseCommand<Commands.InfoQueues, InfoQueuesParameters, unknown>
[Commands.InfoThreads]: TypedResponseCommand<Commands.InfoThreads, InfoThreadsParameters, unknown>
[Commands.InfoDelay]: TypedResponseCommand<Commands.InfoDelay, InfoDelayParameters, unknown>
[Commands.Diag]: TypedResponseCommand<Commands.Diag, DiagParameters, unknown>
[Commands.GlInfo]: TypedResponseCommand<Commands.GlInfo, GlInfoParameters, unknown>
[Commands.GlGc]: TypedResponseCommand<Commands.GlGc, GlGcParameters, unknown>
[Commands.Bye]: TypedResponseCommand<Commands.Bye, ByeParameters, unknown>
[Commands.Kill]: TypedResponseCommand<Commands.Kill, KillParameters, unknown>
[Commands.Restart]: TypedResponseCommand<Commands.Restart, RestartParameters, unknown>
}

export type LoadbgCommand = AllTypedCommands[Commands.Loadbg]['command']
Expand Down

0 comments on commit 7622c14

Please sign in to comment.