Skip to content

Commit

Permalink
Allow nullish extends in interfaceish
Browse files Browse the repository at this point in the history
Otherwise code such as

```ts
t.interfaceDeclaration(
  t.identifier('id'),
  undefined,
  undefined,
  t.objectTypeAnnotation([])
)
```

Will fail when priting with ` TypeError: unknown: Cannot read property 'length' of null`
Despite nullish values being allowed in `t.interfaceDeclaration` definitions
  • Loading branch information
saitonakamura committed Feb 27, 2021
1 parent 265424d commit f313d9b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/babel-generator/src/generators/flow.ts
Expand Up @@ -360,7 +360,7 @@ export function _interfaceish(
) {
this.print(node.id, node);
this.print(node.typeParameters, node);
if (node.extends.length) {
if (node.extends && node.extends.length) {
this.space();
this.word("extends");
this.space();
Expand Down

0 comments on commit f313d9b

Please sign in to comment.