fix(typescript): print typeArguments in TSExpressionWithTypeArguments (#1530)
parent
f51822c16d
commit
8a8a67b9fe
|
@ -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":
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
Loading…
Reference in New Issue