diff --git a/package.json b/package.json index d959a6003..09183ba62 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "semver": "5.4.1", "string-width": "3.0.0", "typescript": "3.2.2", - "typescript-estree": "15.0.0", + "typescript-estree": "18.0.0", "unicode-regex": "2.0.0", "unified": "6.1.6", "vnopts": "1.0.2", diff --git a/src/language-js/printer-estree.js b/src/language-js/printer-estree.js index bd5024ae2..6dc595828 100644 --- a/src/language-js/printer-estree.js +++ b/src/language-js/printer-estree.js @@ -1227,15 +1227,15 @@ function printPathNoParens(path, options, print, args) { " " ); - if (n.heritage.length) { + if (n.extends && n.extends.length) { parts.push( group( indent( concat([ softline, "extends ", - (n.heritage.length === 1 ? identity : indent)( - join(concat([",", line]), path.map(print, "heritage")) + (n.extends.length === 1 ? identity : indent)( + join(concat([",", line]), path.map(print, "extends")) ), " " ]) @@ -2353,7 +2353,7 @@ function printPathNoParens(path, options, print, args) { parts.push(concat(printClass(path, options, print))); return concat(parts); case "TSInterfaceHeritage": - parts.push(path.call(print, "id")); + parts.push(path.call(print, "expression")); if (n.typeParameters) { parts.push(path.call(print, "typeParameters")); @@ -2798,6 +2798,11 @@ function printPathNoParens(path, options, print, args) { path.call(print, "id"), path.call(print, "typeParameters") ]); + case "TSClassImplements": + return concat([ + path.call(print, "expression"), + path.call(print, "typeParameters") + ]); case "TSIntersectionType": case "IntersectionTypeAnnotation": { const types = path.map(print, "types"); @@ -3224,7 +3229,7 @@ function printPathNoParens(path, options, print, args) { n.static ? "static " : "", n.readonly ? "readonly " : "", "[", - path.call(print, "index"), + n.parameters ? concat(path.map(print, "parameters")) : "", "]: ", path.call(print, "typeAnnotation"), parent.type === "ClassBody" ? semi : "" diff --git a/yarn.lock b/yarn.lock index 1207becff..ff37cbd48 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5763,10 +5763,10 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -typescript-estree@15.0.0: - version "15.0.0" - resolved "https://registry.yarnpkg.com/typescript-estree/-/typescript-estree-15.0.0.tgz#1fdc98b8e3bec0f5cdb00a90d8cfc4395d848a86" - integrity sha512-5/dqC8RPfa2jiaY9SSozUM/l3DKT1TuJgJw6SFOfd/Lr3yRjeids8exv1t77W6zeMJ0QGKgU1ZV6eJg/8CjN+w== +typescript-estree@18.0.0: + version "18.0.0" + resolved "https://registry.yarnpkg.com/typescript-estree/-/typescript-estree-18.0.0.tgz#a309f6c6502c64d74b3f88c205d871a9af0b1d40" + integrity sha512-HxTWrzFyYOPWA91Ij7xL9mNUVpGTKLH2KiaBn28CMbYgX2zgWdJqU9hO7Are+pAPAqY91NxAYoaAyDDZ3rLj2A== dependencies: lodash.unescape "4.0.1" semver "5.5.0"