Skip to content

Latest commit

 

History

History

Parser-fails-on-custom-type

Parser fails on custom type

If a script adds a custom type by Add-Type and then defines a class which uses this type directly then the parser fails to process such a script.

The script Test-1.parser.fails.ps1 shows the issue.

Workaround 1

See the script Test-2.1.workaround.ps1. The class definition is moved to another script and this script is dot-sourced after Add-Type.

Workaround 2

See the script Test-2.2.workaround.ps1. The class avoids explicit custom type literals and converts type names to [Type].