Skip to content

Commit

Permalink
prefer-export-from: Ignore variables with type (#1580)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Nov 8, 2021
1 parent 5625dab commit ea49b21
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions rules/prefer-export-from.js
Expand Up @@ -157,6 +157,7 @@ function getExported(identifier, context) {
if (
parent.init === identifier
&& parent.id.type === 'Identifier'
&& !parent.id.typeAnnotation
&& parent.parent.type === 'VariableDeclaration'
&& parent.parent.kind === 'const'
&& parent.parent.declarations.length === 1
Expand Down
13 changes: 13 additions & 0 deletions test/prefer-export-from.mjs
Expand Up @@ -285,3 +285,16 @@ test.snapshot({
`,
],
});

test.typescript({
valid: [
// #1579
outdent`
import {useDispatch as reduxUseDispatch} from 'react-redux'
type MyDispatchType = Dispatch<MyActions>
export const useDispatch: () => DispatchAllActions = reduxUseDispatch
`,
],
invalid: [],
});

0 comments on commit ea49b21

Please sign in to comment.