Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix TSParameterProperty getting lost with transform-classes (#8682)
- Loading branch information
1 parent
380f2a0
commit 8897b67
Showing
7 changed files
with
128 additions
and
58 deletions.
There are no files selected for viewing
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
5 changes: 5 additions & 0 deletions
5
...ansform-typescript/test/fixtures/class/parameter-properties-with-class-and-super/input.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,5 @@ | ||
class Employee extends Person { | ||
constructor(public name: string) { | ||
super(); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...orm-typescript/test/fixtures/class/parameter-properties-with-class-and-super/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-typescript", "transform-classes"] | ||
} |
31 changes: 31 additions & 0 deletions
31
...nsform-typescript/test/fixtures/class/parameter-properties-with-class-and-super/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,31 @@ | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
|
||
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
|
||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
|
||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
|
||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
|
||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
|
||
let Employee = | ||
/*#__PURE__*/ | ||
function (_Person) { | ||
"use strict"; | ||
|
||
_inherits(Employee, _Person); | ||
|
||
function Employee(name) { | ||
var _this; | ||
|
||
_classCallCheck(this, Employee); | ||
|
||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Employee).call(this)); | ||
_this.name = name; | ||
return _this; | ||
} | ||
|
||
return Employee; | ||
}(Person); |
3 changes: 3 additions & 0 deletions
3
...-plugin-transform-typescript/test/fixtures/class/parameter-properties-with-class/input.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,3 @@ | ||
class Person { | ||
constructor(public name: string) {} | ||
} |
3 changes: 3 additions & 0 deletions
3
...gin-transform-typescript/test/fixtures/class/parameter-properties-with-class/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-typescript", "transform-classes"] | ||
} |
15 changes: 15 additions & 0 deletions
15
...plugin-transform-typescript/test/fixtures/class/parameter-properties-with-class/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,15 @@ | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
|
||
let Person = | ||
/*#__PURE__*/ | ||
function () { | ||
"use strict"; | ||
|
||
function Person(name) { | ||
_classCallCheck(this, Person); | ||
|
||
this.name = name; | ||
} | ||
|
||
return Person; | ||
}(); |