@@ -116,15 +116,6 @@ export type ViewDisplayConfig = z.infer<typeof viewDisplaySchema>;
116
116
// Stock Actions
117
117
// *************************************************************************
118
118
119
- // Declare schemas for existing types.
120
- // See: https://github.com/colinhacks/zod/issues/372#issuecomment-826380330
121
- const schemaForType =
122
- < T > ( ) =>
123
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
124
- < S extends z . ZodType < T , any , any > > ( arg : S ) => {
125
- return arg ;
126
- } ;
127
-
128
119
// https://www.home-assistant.io/dashboards/actions/#options-for-confirmation
129
120
const actionBaseSchema = z . object ( {
130
121
confirmation : z
@@ -153,15 +144,13 @@ const toggleActionSchema = actionBaseSchema.extend({
153
144
} ) ;
154
145
export type ToggleActionConfig = z . infer < typeof toggleActionSchema > ;
155
146
156
- const targetSchema = schemaForType < HassServiceTarget > ( ) (
157
- z . object ( {
158
- entity_id : z . string ( ) . or ( z . string ( ) . array ( ) ) . optional ( ) ,
159
- device_id : z . string ( ) . or ( z . string ( ) . array ( ) ) . optional ( ) ,
160
- area_id : z . string ( ) . or ( z . string ( ) . array ( ) ) . optional ( ) ,
161
- floor_id : z . string ( ) . or ( z . string ( ) . array ( ) ) . optional ( ) ,
162
- label_id : z . string ( ) . or ( z . string ( ) . array ( ) ) . optional ( ) ,
163
- } ) ,
164
- ) ;
147
+ const targetSchema : z . ZodSchema < HassServiceTarget , z . ZodTypeDef > = z . object ( {
148
+ entity_id : z . string ( ) . or ( z . string ( ) . array ( ) ) . optional ( ) ,
149
+ device_id : z . string ( ) . or ( z . string ( ) . array ( ) ) . optional ( ) ,
150
+ area_id : z . string ( ) . or ( z . string ( ) . array ( ) ) . optional ( ) ,
151
+ floor_id : z . string ( ) . or ( z . string ( ) . array ( ) ) . optional ( ) ,
152
+ label_id : z . string ( ) . or ( z . string ( ) . array ( ) ) . optional ( ) ,
153
+ } ) ;
165
154
166
155
const performActionActionSchema = actionBaseSchema . extend ( {
167
156
action : z . literal ( 'perform-action' ) ,
0 commit comments