Skip to main content

Is there a simple way to use Zapier schema as typescript interface type? Consider trigger definition from typescript zapier template.

import { Bundle, ZObject } from 'zapier-platform-core';

const perform = async (z: ZObject, bundle: Bundle) => {
const response = await z.request(
'https://auth-json-server.zapier-staging.com/movies'
);
return response.data;
};

const triggerOp = {
perform,
sample: {
id: '1',
title: 'example',
},
};

export default {
key: 'movie',
noun: 'Movie',

display: {
label: 'New Movie',
description: 'Triggers when a new movie is created.',
},

operation: triggerOp,
};

Is there a way to assign type to object “triggerOp” like

const triggerOp: BasicHookOperationSchema = { /*rest hook operation properties */ }

OR

const triggerOp:BasicPollingOperationSchema = { /*polling operation properties */}