TypeScript: Support conditional types syntax (#7404)

Microsoft/TypeScript#21316 and Microsoft/TypeScript#21496
This commit is contained in:
Andy
2018-02-24 05:56:14 -08:00
committed by Nicolò Ribaudo
parent 960fa66c9e
commit 6f6c8dabba
16 changed files with 587 additions and 1 deletions

View File

@@ -256,6 +256,28 @@ export function tsPrintUnionOrIntersectionType(node, sep) {
});
}
export function TSConditionalType(node) {
this.print(node.checkType);
this.space();
this.word("extends");
this.space();
this.print(node.extendsType);
this.space();
this.token("?");
this.space();
this.print(node.trueType);
this.space();
this.token(":");
this.space();
this.print(node.falseType);
}
export function TSInferType(node) {
this.token("infer");
this.space();
this.print(node.typeParameter);
}
export function TSParenthesizedType(node) {
this.token("(");
this.print(node.typeAnnotation, node);