Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(type-utils): preventing isUnsafeAssignment infinite recursive calls#8237

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JoshuaKGoldberg merged 2 commits intotypescript-eslint:mainfromyeonjuan:fix/7298
Jan 16, 2024

Conversation

yeonjuan
Copy link
Contributor

@yeonjuanyeonjuan commentedJan 11, 2024
edited
Loading

PR Checklist

Overview

This PR prevents infinite recursive calls toisUnsafeAssignment for code with circular references.

no-unsafe-argument (#7298,#5014)

playground

typeT=[number,T[]];declarefunctionfoo(t:T):void;declareconstt:T;foo(t);
RangeError: Maximum call stack size exceeded...

no-unsafe-assignment (unreported issue)

playground

typeT=[string,T[]];consttest:T=['string',[]]asT;
RangeError: Maximum call stack size exceeded..

@typescript-eslint
Copy link
Contributor

Thanks for the PR,@yeonjuan!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently onhttps://opencollective.com/typescript-eslint.

@netlifyNetlify
Copy link

netlifybot commentedJan 11, 2024
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commita84ed04
🔍 Latest deploy loghttps://app.netlify.com/sites/typescript-eslint/deploys/65a5361bdc580f0007a82cbb
😎 Deploy Previewhttps://deploy-preview-8237--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 89 (🔴 down 7 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to yourNetlify site configuration.

@yeonjuanyeonjuan changed the titlefix(type-utils): Preventing isUnsafeAssignment infinite recursive callsfix(type-utils): preventing isUnsafeAssignment infinite recursive callsJan 11, 2024
JoshuaKGoldberg
JoshuaKGoldberg previously approved these changesJan 11, 2024
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the double-fix! 🚀 🚀

Just suggesting changes for the one refactor. If I missed something on it then no worries we can ship as-is.

Comment on lines 23 to 39
visited = new Map<ts.Type, Set<ts.Type>>(),
): false | { sender: ts.Type; receiver: ts.Type } {

Choose a reason for hiding this comment

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

[Refactor] This code works great as-is, but has a couple of little paper cuts IMO:

  • Each call now has to check whethervisited exists(this is not really a big issue at all, certainly not a blocker)
  • Callers now can see thisvisitedMap even though there's no reason for them to provide it

What do you think about making a non-exported worker function so the public signature doesn't need to havevisited?

  senderNode:TSESTree.Node|null,):false|{sender:ts.Type; receiver:ts.Type}{returnisUnsafeAssignmentWorker(type,receiver,checker,senderNode,newMap());

yeonjuan reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

What do you think about making a non-exported worker function so the public signature doesn't need to have visited?

I think it's much better. let me refactor it! :)

JoshuaKGoldberg reacted with rocket emoji
@JoshuaKGoldbergJoshuaKGoldberg added awaiting responseIssues waiting for a reply from the OP or another party 1 approval>=1 team member has approved this PR; we're now leaving it open for more reviews before we merge labelsJan 11, 2024
@github-actionsgithub-actionsbot removed the awaiting responseIssues waiting for a reply from the OP or another party labelJan 15, 2024
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Rachel Brosnahan on a boat as The Marvelous Mrs. Maisel. Relaxed, in sunglasses with a drink. Caption: "THIS IS GLORIOUS"

@JoshuaKGoldbergJoshuaKGoldberg merged commit01556f5 intotypescript-eslint:mainJan 16, 2024
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsJan 24, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@JoshuaKGoldbergJoshuaKGoldbergJoshuaKGoldberg approved these changes

Assignees
No one assigned
Labels
1 approval>=1 team member has approved this PR; we're now leaving it open for more reviews before we merge
Projects
None yet
Milestone
No milestone
2 participants
@yeonjuan@JoshuaKGoldberg

[8]ページ先頭

©2009-2025 Movatter.jp