This is an expected behavior:
PS C:\> Test-Path -Path C:\MyFolder\ -IsValid -PathType Container True PS C:\>
However, this seems to be incorrect:
PS C:\> Test-Path -Path C:\MyFolder\ -IsValid -PathType Leaf True PS C:\>
According to the official documentation:
"Leaf. An element that does not contain other elements, such as a file."https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/test-path?view=powershell-6
Is it a bug or did I miss something?