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
Christopher Chedeau 2017-05-04 11:20:52 -07:00 committed by GitHub
parent 1fca1eeddf
commit 1a1e6fc1dd
4 changed files with 13 additions and 2 deletions

View File

@ -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"
) {

View File

@ -0,0 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`badArrayIndex.ts 1`] = `
var results = number[];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var results = number[];
`;

View File

@ -0,0 +1 @@
var results = number[];

View File

@ -0,0 +1 @@
run_spec(__dirname, { parser: "typescript" });