-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: TypeScript annotation affects output (#16377)
skip TSTypeAnnotation
- Loading branch information
1 parent
ee48754
commit e779cad
Showing
4 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
...es/babel-plugin-transform-classes/test/fixtures/misc/function-name-ts-annotation/input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class Database { | ||
transaction( | ||
// If the type annotation here contains the *name of the method* | ||
// then it changes how the method is compiled. Rename `transaction` | ||
// below and see how the output changes. | ||
callback: (transaction: Transaction) => unknown, | ||
) { | ||
return this.table.transaction( | ||
(x) => callback(new DaoTransaction(x)), | ||
); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...abel-plugin-transform-classes/test/fixtures/misc/function-name-ts-annotation/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"plugins": ["transform-classes", "transform-typescript"] | ||
} |
17 changes: 17 additions & 0 deletions
17
...s/babel-plugin-transform-classes/test/fixtures/misc/function-name-ts-annotation/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
let Database = /*#__PURE__*/function () { | ||
"use strict"; | ||
|
||
function Database() { | ||
babelHelpers.classCallCheck(this, Database); | ||
} | ||
return babelHelpers.createClass(Database, [{ | ||
key: "transaction", | ||
value: function transaction( | ||
// If the type annotation here contains the *name of the method* | ||
// then it changes how the method is compiled. Rename `transaction` | ||
// below and see how the output changes. | ||
callback) { | ||
return this.table.transaction(x => callback(new DaoTransaction(x))); | ||
} | ||
}]); | ||
}(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters