Now I have made some crucial progress. It seems that the change-event-handler of the uploadbutton is a critical spot (or rather: time) to read out the validity . fileTypeNotAllowed - property. So my code is like this:
export function uploadButton1_change(event)
{console.log($w('#uploadButton1').validity.fileTypeNotAllowed)}
and the website visitor chooses a file of the wrong type, the message in the console is false, which is not what I expect, but if you put in a little time delay like this:
export function uploadButton1_change(event)
{setTimeout( () =>
console.log($w('#uploadButton1').validity.fileTypeNotAllowed),200) }
and you choose a wrong file type, the answer is true, which is precisely what I want.