Custom component - configuration entity or a value

I know in the configuration of an entity (eg generic thermostat) that some of the configruation can be either values or an entity.

Is it possible to allow either other those for a particular config item. Ie can the user set a value, or utilise another input_number for example.

How can I detect in the configration that something is an value or an entity, short of having

myconfigitem: 10
myconfigitem_entity: input_number.number10

Or is this the most logical way of doing it, and just figure out in my custom component that it’s either 10 or the value from entity input_number.number10?