parent
41688901f2
commit
642ac7e230
|
@ -2300,6 +2300,7 @@ function genericPrintNoParens(path, options, print, args) {
|
||||||
case "TSParenthesizedType":
|
case "TSParenthesizedType":
|
||||||
return concat(["(", path.call(print, "typeAnnotation"), ")"]);
|
return concat(["(", path.call(print, "typeAnnotation"), ")"]);
|
||||||
case "TSIndexSignature": {
|
case "TSIndexSignature": {
|
||||||
|
const parent = path.getParentNode();
|
||||||
let printedParams = [];
|
let printedParams = [];
|
||||||
if (n.params) {
|
if (n.params) {
|
||||||
printedParams = path.map(print, "params");
|
printedParams = path.map(print, "params");
|
||||||
|
@ -2319,7 +2320,8 @@ function genericPrintNoParens(path, options, print, args) {
|
||||||
// it using parseDelimitedList that uses commas as delimiter.
|
// it using parseDelimitedList that uses commas as delimiter.
|
||||||
join(", ", printedParams),
|
join(", ", printedParams),
|
||||||
"]: ",
|
"]: ",
|
||||||
path.call(print, "typeAnnotation")
|
path.call(print, "typeAnnotation"),
|
||||||
|
parent.type === "ClassBody" ? semi : ""
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
case "TSTypePredicate":
|
case "TSTypePredicate":
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`index-signature.ts 1`] = `
|
||||||
|
class LocalStorage implements Storage {
|
||||||
|
[index: number]: string;
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
class LocalStorage implements Storage {
|
||||||
|
[index: number]: string;
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
`;
|
|
@ -0,0 +1,4 @@
|
||||||
|
class LocalStorage implements Storage {
|
||||||
|
[index: number]: string;
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
run_spec(__dirname, { parser: "typescript" });
|
|
@ -1,5 +1,18 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`index-signature.ts 1`] = `
|
||||||
|
class LocalStorage implements Storage {
|
||||||
|
[index: number]: string;
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
class LocalStorage implements Storage {
|
||||||
|
[index: number]: string
|
||||||
|
[key: string]: any
|
||||||
|
}
|
||||||
|
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`interface.ts 1`] = `
|
exports[`interface.ts 1`] = `
|
||||||
interface Inline { x: string }
|
interface Inline { x: string }
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
class LocalStorage implements Storage {
|
||||||
|
[index: number]: string;
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
Loading…
Reference in New Issue