As already mentioned by @VLAZ, That is actually not a runtime error. that is a transpile time error. you declared:
type TParser = (str: string, errStr: string) => number;
which is actually wrong. since there is a default parameter, we need to make errStr optional.
type TParser = (str: string, errStr?: string) => number;
notice the added ? before : string,that is used to indicate the parameter is optional, you can give a value to it, or you may not, typescript will allow you.
here are some helpful links: