Allow unknown/any in TS catch clause param (#11755)

This commit is contained in:
Brian Ng
2020-06-30 03:40:20 -05:00
committed by Huáng Jùnliàng
parent 5b4b3a3e4a
commit 8a1d7e41f2
7 changed files with 337 additions and 6 deletions

View File

@@ -2660,4 +2660,15 @@ export default (superClass: Class<Parser>): Class<Parser> =>
return hasContextParam ? baseCount + 1 : baseCount;
}
parseCatchClauseParam(): N.Identifier {
const param = super.parseCatchClauseParam();
const type = this.tsTryParseTypeAnnotation();
if (type) {
param.type = type;
}
return param;
}
};