Skip to content

Commit 149cceb

Browse files
committed
Closes #9, Closes #10
1 parent 12f5aec commit 149cceb

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

Diff for: lib/utils/ast.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ module.exports = {
103103
* @private
104104
*/
105105
getPropertyName(node) {
106-
return module.exports.getStaticPropertyName(node) || node.key.name || null;
106+
return (
107+
module.exports.getStaticPropertyName(node) ||
108+
(node.key && node.key.name) ||
109+
null
110+
);
107111
},
108112
};

Diff for: tests/fixtures/autofix.input.ts

+9
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,12 @@ type Type2 = {/* %foo */
9999
*/
100100
bar: boolean;
101101
}
102+
103+
interface ClockConstructor {
104+
new (hour: number, minute: number): ClockInterface;
105+
new (hour: number): ClockInterface;
106+
}
107+
108+
interface ClockInterface {
109+
tick(): void;
110+
}

Diff for: tests/fixtures/autofix.output.ts

+9
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,12 @@ type Type2 = {
101101
/* %foo */
102102
foo: boolean;
103103
}
104+
105+
interface ClockConstructor {
106+
new (hour: number, minute: number): ClockInterface;
107+
new (hour: number): ClockInterface;
108+
}
109+
110+
interface ClockInterface {
111+
tick(): void;
112+
}

0 commit comments

Comments
 (0)