Question

Use zapier schema as typescript interface type

  • 10 December 2021
  • 0 replies
  • 68 views

Userlevel 1

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 */}

 


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.