Skip to content

Commit

Permalink
Add test for babel/babel#12111
Browse files Browse the repository at this point in the history
  • Loading branch information
sosukesuzuki committed Oct 16, 2020
1 parent 58cbf8b commit cab1ee7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/language-js/printer-estree.js
Expand Up @@ -3118,6 +3118,7 @@ function printPathNoParens(path, options, print, args) {
n.accessibility ? concat([n.accessibility, " "]) : "",
n.static ? "static " : "",
n.readonly ? "readonly " : "",
n.declare ? "declare " : "",
"[",
n.parameters ? parametersGroup : "",
n.typeAnnotation ? "]: " : "]",
Expand Down
20 changes: 20 additions & 0 deletions tests/misc/typescript-babel-only/__snapshots__/jsfmt.spec.js.snap
@@ -1,5 +1,25 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`declare-index-signature.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
printWidth: 80
| printWidth
=====================================input======================================
// Invalid, but recoverable
class C {
declare [key: string]: string;
}
=====================================output=====================================
// Invalid, but recoverable
class C {
declare [key: string]: string;
}
================================================================================
`;

exports[`tuple-labeled-ts.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
Expand Down
4 changes: 4 additions & 0 deletions tests/misc/typescript-babel-only/declare-index-signature.ts
@@ -0,0 +1,4 @@
// Invalid, but recoverable
class C {
declare [key: string]: string;
}

0 comments on commit cab1ee7

Please sign in to comment.