-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle undefined typeParameters (#1495)
<!-- 👋 Hi, thanks for sending a PR to TypeStat! 💖. Please fill out all fields below and make sure each item is true and [x] checked. Otherwise we may not be able to review your PR. --> ## PR Checklist - [x] Addresses an existing open issue: fixes #1427 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/TypeStat/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/TypeStat/blob/main/.github/CONTRIBUTING.md) were taken 🐙 ## Overview <!-- Description of what is changed and how the code change does that. --> `templatedDeclaration.typeParameters` was undefined in some situations, which threw an error. Added new regression test category as this is not really test about how the fixes work otherwise. Probably the test case could be simplified, but I'm going with mindset that fixed bug is better than none. --------- Co-authored-by: rubiesonthesky <rubiesonthesky> Co-authored-by: Josh Goldberg ✨ <[email protected]>
- Loading branch information
1 parent
e2ed0f5
commit 22c7ee3
Showing
6 changed files
with
30 additions
and
7 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
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
7 changes: 7 additions & 0 deletions
7
test/cases/fixes/incompleteTypes/nonGenericInterfaceAsTypeArgument/expected.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,7 @@ | ||
(function () { | ||
interface Shape { | ||
value?: unknown; | ||
} | ||
|
||
[].reduce<Shape>(() => ({}), {}); | ||
})(); |
7 changes: 7 additions & 0 deletions
7
test/cases/fixes/incompleteTypes/nonGenericInterfaceAsTypeArgument/original.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,7 @@ | ||
(function () { | ||
interface Shape { | ||
value?: unknown; | ||
} | ||
|
||
[].reduce<Shape>(() => ({}), {}); | ||
})(); |
3 changes: 3 additions & 0 deletions
3
test/cases/fixes/incompleteTypes/nonGenericInterfaceAsTypeArgument/tsconfig.json
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,3 @@ | ||
{ | ||
"files": ["actual.ts"] | ||
} |
5 changes: 5 additions & 0 deletions
5
test/cases/fixes/incompleteTypes/nonGenericInterfaceAsTypeArgument/typestat.json
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,5 @@ | ||
{ | ||
"fixes": { | ||
"incompleteTypes": true | ||
} | ||
} |