bryntum / support

An issues-only repository for the Bryntum project management component suite which includes powerful Grid, Scheduler, Calendar, Kanban Task Board and Gantt chart components all built in pure JS / CSS / TypeScript
https://www.bryntum.com
53 stars 6 forks source link

[ANGULAR] Providing a `type` attribute for widget throws an exception #9537

Closed canonic-epicure closed 4 weeks ago

canonic-epicure commented 1 month ago

Extracted from https://github.com/bryntum/support/issues/9520

Steps to reproduce:

<bryntum-undo-redo ref='undoRedo' type='undoredo' [project]="project">

<bryntum-gantt [project] = "project"

- compile/run
- observe the exception
![image](https://github.com/bryntum/support/assets/72431/5ce15ddf-6500-41e4-9429-d87fe4326c80)
- The line causing it is `type='undoredo'`, which is not necessary, however it seems harmless.
- Changing this line to `[type]='undoredo'` causes a compilation error:

Compiled with problems:X

ERROR

src/app/app.component.html:28:13 - error TS2339: Property 'undoredo' does not exist on type 'AppComponent'.

28 [type]='undoredo'



  src/app/app.component.ts:8:21
```

This code snippet provided by the user, which was using 5.3.4, so I guess it used to work in that version.
canonic-epicure commented 1 month ago

Currently type property of the widget is read-only and defined on prototype. So this line will throw in vanilla code: const a = new Toast({ type : 'toast' }); or const a = new UndoRedo({ type : 'undoredo' });

Nobody have ever complained about this, but still this is probably unexpected.

As discussed with Saki, the course of actions would be to make type property writeable, and only throw if some different type value is being assigned. If the same value is attempted to be assigned - just ignore it.