Support TypeScript mapped type 'as' clauses (#12129)

This commit is contained in:
Brian Ng
2020-10-14 13:16:22 -05:00
committed by GitHub
parent 3fd963fdc8
commit 6830c90ac9
11 changed files with 358 additions and 2 deletions

View File

@@ -620,6 +620,8 @@ export default (superClass: Class<Parser>): Class<Parser> =>
this.expect(tt.bracketL);
node.typeParameter = this.tsParseMappedTypeParameter();
node.nameType = this.eatContextual("as") ? this.tsParseType() : null;
this.expect(tt.bracketR);
if (this.match(tt.plusMin)) {

View File

@@ -1340,6 +1340,7 @@ export type TsMappedType = TsTypeBase & {
typeParameter: TsTypeParameter,
optional?: true | "+" | "-",
typeAnnotation: ?TsType,
nameType: ?TsType,
};
export type TsLiteralType = TsTypeBase & {