Skip to content

Commit 0a0856f

Browse files
committed
feature: @putout/plugin-declare-before-reference: exclude TSTypeAliasDeclaration
1 parent 02556f4 commit 0a0856f

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

packages/plugin-declare-before-reference/lib/declare-before-reference.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ export const traverse = ({push}) => ({
7777
if (uid !== referenceUid && uid !== blockUid)
7878
continue;
7979

80+
if (referenceParentPath.isTSTypeAliasDeclaration())
81+
break;
82+
8083
if (referenceParentPath.isExportDefaultDeclaration())
8184
break;
8285

packages/plugin-declare-before-reference/test/declare-before-reference.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ test('plugin-declare-before-reference: no report: cross-reference', (t) => {
150150
t.end();
151151
});
152152

153+
test('plugin-declare-before-reference: no report: type', (t) => {
154+
t.noReport('type');
155+
t.end();
156+
});
157+
153158
test('plugin-declare-before-reference: transform: tape', (t) => {
154159
const plugin = {
155160
report: () => '',
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
type hello = () => {};
2+
3+
const hello: hello = () => {};

0 commit comments

Comments
 (0)