Skip to content

Commit

Permalink
Add tests for babel/babel#13143
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Apr 25, 2021
1 parent d0ddfeb commit 65a8d0c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
Expand Up @@ -16,6 +16,16 @@ exports[`classAbstractMethodWithImplementation.ts [babel-ts] format 1`] = `
3 | }"
`;

exports[`declare-accessor.ts [babel-ts] format 1`] = `
"'declare' is not allowed in getters. (2:3)
1 | class Foo {
> 2 | declare get foo()
| ^
3 | declare set foo(v)
4 | }
5 |"
`;

exports[`snippet: #0 [babel-ts] format 1`] = `
"Invalid left-hand side in assignment expression (1:1)
> 1 | foo as any = 10;
Expand Down
4 changes: 4 additions & 0 deletions tests/misc/errors/typescript/babel-ts/declare-accessor.ts
@@ -0,0 +1,4 @@
class Foo {
declare get foo()
declare set foo(v)
}
20 changes: 20 additions & 0 deletions tests/typescript/declare/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -195,3 +195,23 @@ declare const hello2 = 5;
================================================================================
`;
exports[`declare-get-set-field.ts format 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
class C {
declare get: string
declare set: string;
}
=====================================output=====================================
class C {
declare get: string;
declare set: string;
}
================================================================================
`;
4 changes: 4 additions & 0 deletions tests/typescript/declare/declare-get-set-field.ts
@@ -0,0 +1,4 @@
class C {
declare get: string
declare set: string;
}

0 comments on commit 65a8d0c

Please sign in to comment.