Thursday, May 26, 2022

[SOLVED] Type 'Event' is missing the following properties from type 'CronOptions'

Issue

I want to use cron-editor in my angular form but getting this error in the terminal,

src="https://i.stack.imgur.com/2AFKk.png" alt="enter image description here" />

These are the cronOptions I was using.

 this.cronExpression = '4 3 2 12 1/1 ? *';
    this.cronOptions = {
      formInputClass: 'form-control cron-editor-input event',
      formSelectClass: 'form-control cron-editor-select',
      formRadioClass: 'cron-editor-radio',
      formCheckboxClass: 'cron-editor-checkbox',

      defaultTime: '10:00:00',
      use24HourTime: true,

      hideMinutesTab: true,
      hideHourlyTab: false,
      hideDailyTab: false,
      hideWeeklyTab: false,
      hideMonthlyTab: false,
      hideYearlyTab: false,
      hideAdvancedTab: true,

      hideSeconds: false,
      removeSeconds: false,
      removeYears: false

The error I am getting in my terminal is:

Type 'Event' is missing the following properties from type 'CronOptions': formInputClass, formSelectClass, formRadioClass, formCheckboxClass, and 12 more.

Edit: I have declared as public cronOptions: CronOptions; where the type is imported as import { CronOptions } from 'cron-editor/lib/CronOptions';


Solution

You need to remove the two way binding.

Options passed to a component are usually just inputs, not outputs.

There error states that : it does not recognize the CronOptions as an Event.

<cron-editor [cron]="cronExpression" [options]="cronOptions">
</cron-editor>



Answered By - temp_user
Answer Checked By - Timothy Miller (WPSolving Admin)