Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: incorrect typedef parsing for interfaces (#24192)
* fix: incorrect typedef parsing for interfaces Wasn't finding typedefs for interfaces with the same name as the typed thing; e.g. ```ts interface Foo {} const Foo: Foo ``` Also adds a guard and more helpful error when unavoidable loops occur due to type naming * test: add tests
- Loading branch information
Showing
4 changed files
with
41 additions
and
16 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
14 changes: 14 additions & 0 deletions
14
packages/gatsby-transformer-documentationjs/src/__tests__/fixtures/same-name.ts
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,14 @@ | ||
|
||
/** | ||
* The actual type | ||
*/ | ||
export declare interface Foo { | ||
(props: any): JSX.Element | null; | ||
} | ||
|
||
/** | ||
* The Main Thing here | ||
*/ | ||
const Foo: Foo = () => null; | ||
|
||
|
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
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