Page 1 of 1

[REACT] [SchedulerPro] 5.3.1 TypeScript typings

Posted: Fri Mar 31, 2023 12:35 am
by jamesb

Hello,

I noticed the TS typing have been updated in the 5.3 release.
We have two areas of our code (unchanged) that are impacted by the new typings following the update.

The following items object is part of the tbar config:

const tbar = { items: {
	layout: {
		type: "combo",
		items: [
			['stack', 'Stack'],
			['pack', 'Pack']
		],
		value: this.getEventLayout(),
		onChange: (e: any) => this.setEventLayout(e.value)
	}, ...
};
...
	<BryntumSchedulerPro
		project = {project}
		tbar = {tbar}
		...
	>
}

The TS compiler returns the following error:

TS2769: No overload matches this call.
Types of property 'type' are incompatible.
Type '"combo"' is not assignable to type '"schedulingmodecombo" | undefined'.

The other error is about a property we don't use in our code: maskDefaults.
The error is highlighted on the BryntumSchedulerPro React component:

      TS2769: No overload matches this call.
  Overload 1 of 2, '(props: BryntumSchedulerProProps | Readonly<BryntumSchedulerProProps>): BryntumSchedulerPro', gave the following error.
    Types of property 'maskDefaults' are incompatible.
      Type 'Partial<MaskConfig> | Mask | undefined' is not assignable to type 'Partial<MaskConfig> | undefined'.
        Type 'Mask' has no properties in common with type 'Partial<MaskConfig>'.
  Overload 2 of 2, '(props: BryntumSchedulerProProps, context: any): BryntumSchedulerPro', gave the following error.
    Types of property 'maskDefaults' are incompatible.
      Type 'Partial<MaskConfig> | Mask | undefined' is not assignable to type 'Partial<MaskConfig> | undefined'.

Is there a specific version of TS that you recommend?
Was there any change that could explain why this code which compiled with 5.2.x now fails to compile with 5.3.x?

Thank you,
J


Re: [REACT] [SchedulerPro] 5.3.1 TypeScript typings

Posted: Fri Mar 31, 2023 7:18 am
by alex.l

Hi J,

I've opened a ticket to investigate this problem https://github.com/bryntum/support/issues/6499
Meanwhile please use @ts-ignore for workaround.


Re: [REACT] [SchedulerPro] 5.3.1 TypeScript typings

Posted: Fri Mar 31, 2023 8:10 am
by sergey.maltsev

Hi, J!

Could you please attach application which we can run and see the problem.
I was not able to reproduce errors with your configs above added to our react typescript basic demo.
Bundled demos can be found here https://bryntum.com/products/schedulerpro/docs/guide/SchedulerPro/download.