fix(typescript): print typeArguments in TSExpressionWithTypeArguments (#1530)

master
Lucas Azzola 2017-05-06 23:17:48 +10:00 committed by Christopher Chedeau
parent f51822c16d
commit 8a8a67b9fe
3 changed files with 57 additions and 1 deletions

View File

@ -1590,7 +1590,10 @@ function genericPrintNoParens(path, options, print, args) {
case "TSHeritageClause":
return join(", ", path.map(print, "types"));
case "TSExpressionWithTypeArguments":
return path.call(print, "expression");
return concat([
path.call(print, "expression"),
printTypeParameters(path, options, print, "typeArguments")
]);
case "TemplateElement":
return join(literalline, n.value.raw.split(/\r?\n/g));
case "TemplateLiteral":

View File

@ -18,6 +18,43 @@ interface i2 {
`;
exports[`checkInfiniteExpansionTermination.ts 1`] = `
// Regression test for #1002
// Before fix this code would cause infinite loop
interface IObservable<T> {
n: IObservable<T[]>; // Needed, must be T[]
}
// Needed
interface ISubject<T> extends IObservable<T> { }
interface Foo { x }
interface Bar { y }
var values: IObservable<Foo>;
var values2: ISubject<Bar>;
values = values2;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Regression test for #1002
// Before fix this code would cause infinite loop
interface IObservable<T> {
n: IObservable<T[]> // Needed, must be T[]
}
// Needed
interface ISubject<T> extends IObservable<T> {}
interface Foo { x }
interface Bar { y }
var values: IObservable<Foo>;
var values2: ISubject<Bar>;
values = values2;
`;
exports[`functionOverloadsOnGenericArity1.ts 1`] = `
// overloading on arity not allowed
interface C {

View File

@ -0,0 +1,16 @@
// Regression test for #1002
// Before fix this code would cause infinite loop
interface IObservable<T> {
n: IObservable<T[]>; // Needed, must be T[]
}
// Needed
interface ISubject<T> extends IObservable<T> { }
interface Foo { x }
interface Bar { y }
var values: IObservable<Foo>;
var values2: ISubject<Bar>;
values = values2;