Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle undefined typeParameters #1495

Conversation

rubiesonthesky
Copy link
Collaborator

PR Checklist

Overview

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.

Copy link
Owner

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Nice find! The functionality makes sense to me. Fun little quirk of type predicates that you can be bit like this!

Requesting changes on a small nit for naming and a larger thing for shrinking down the test. Thanks!

test/cases/regresssionTests/1427/original.ts Outdated Show resolved Hide resolved
src/shared/nodeTypes.ts Outdated Show resolved Hide resolved
@JoshuaKGoldberg JoshuaKGoldberg added the status: waiting for author Needs an action taken by the original poster label Apr 1, 2024
@rubiesonthesky rubiesonthesky merged commit 22c7ee3 into JoshuaKGoldberg:main Apr 1, 2024
11 checks passed
@rubiesonthesky rubiesonthesky deleted the handle-undefined-typeParameters branch April 1, 2024 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for author Needs an action taken by the original poster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: Cannot read properties of undefined (reading '0') - weird errors
2 participants