Skip to content

Commit e960d8c

Browse files
committed
fix(typescript): Do not forward typeParameters when using resolved Path
1 parent cc14018 commit e960d8c

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/utils/__tests__/getTSType-test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,22 @@ describe('getTSType', () => {
636636
});
637637
});
638638

639+
it('handles generics of the same Name', () => {
640+
const typePath = statement(`
641+
interface Props {
642+
baz: Foo<T>
643+
}
644+
645+
type Foo<T> = Bar<T>
646+
647+
`)
648+
.get('body')
649+
.get('body', 0)
650+
.get('typeAnnotation');
651+
652+
getTSType(typePath);
653+
});
654+
639655
it('handles self-referencing type cycles', () => {
640656
const typePath = statement(`
641657
let action: Action;

src/utils/getTSType.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function handleTSTypeReference(
100100
}
101101

102102
if (typeParams && typeParams[type.name]) {
103-
type = getTSTypeWithResolvedTypes(resolvedPath, typeParams);
103+
type = getTSTypeWithResolvedTypes(resolvedPath);
104104
}
105105

106106
if (resolvedPath && resolvedPath.node.typeAnnotation) {

0 commit comments

Comments
 (0)