Set the container display to be grid and enter a rule for grid-template-columns
Save
Switch the display of the container to flex
Save
Inspect the front-end and you will see that grid-template-columns is written into the css even though the display is flex. Probably any other grid css styling would also be written out to the css.
If the display is flex, no grid styling should be written out and vice versa.
Correct, the values you set are written to the stylesheet. In this case, however, they have no influence on the flex container. On the other hand, you can use the flex settings in a grid, so that the logic for the “automatic removal of settings you have set yourself” can get super complex and would probably lead to more problems than is the case now.
Apart from one more line of CSS, there is no problem, and you are responsible for the extra line. If you don’t want them, clear the grid-template-columns setting and everything is fine.