Print empty member lookup (#1506)
I have no idea if it's even valid but it threw on 8 typescript tests, now it doesn't. ```js TypeError: Cannot read property 'type' of null at printMemberLookup (prettier/src/printer.js:3062:16) ```master
parent
1fca1eeddf
commit
1a1e6fc1dd
|
@ -775,7 +775,7 @@ function genericPrintNoParens(path, options, print, args) {
|
|||
path.call(print, "name"),
|
||||
printTypeParameters(path, options, print, "typeParameters"),
|
||||
" "
|
||||
);
|
||||
);
|
||||
}
|
||||
if (n.heritageClauses) {
|
||||
prefix.push(
|
||||
|
@ -2149,7 +2149,7 @@ function genericPrintNoParens(path, options, print, args) {
|
|||
if (n.type !== "TSCallSignature") {
|
||||
parts.push("new ");
|
||||
}
|
||||
var isType = n.type === "TSConstructorType";
|
||||
var isType = n.type === "TSConstructorType";
|
||||
parts.push(
|
||||
printTypeParameters(path, options, print, "typeParameters"),
|
||||
"(",
|
||||
|
@ -3063,6 +3063,7 @@ function printMemberLookup(path, options, print) {
|
|||
}
|
||||
|
||||
if (
|
||||
!n.property ||
|
||||
(n.property.type === "Literal" && typeof n.property.value === "number") ||
|
||||
n.property.type === "NumericLiteral"
|
||||
) {
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`badArrayIndex.ts 1`] = `
|
||||
var results = number[];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var results = number[];
|
||||
|
||||
`;
|
|
@ -0,0 +1 @@
|
|||
var results = number[];
|
|
@ -0,0 +1 @@
|
|||
run_spec(__dirname, { parser: "typescript" });
|
Loading…
Reference in New Issue