Skip to content

feat(typescript-estree): forbid .body, .async, .generator on declare function #9225

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

Merged

Conversation

Josh-Cena
Copy link
Member

PR Checklist

Overview

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @Josh-Cena!

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 on https://opencollective.com/typescript-eslint.

Copy link

netlify bot commented Jun 3, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit bee58c7
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/665eb182f98e2000085d1dca
😎 Deploy Preview https://deploy-preview-9225--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: 100 (🟢 up 1 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 your Netlify site configuration.

Copy link

nx-cloud bot commented Jun 3, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit bee58c7. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 31 targets

Sent with 💌 from NxCloud.

@Josh-Cena Josh-Cena requested a review from bradzacher June 3, 2024 12:15
@Josh-Cena Josh-Cena force-pushed the function-decl-ast-invariant branch from 4910e5c to 2303eeb Compare June 3, 2024 16:38
@bradzacher bradzacher added the AST PRs and Issues about the AST structure label Jun 4, 2024
Comment on lines 29 to 31
export interface TSDeclareFunctionNoDeclare extends TSDeclareFunctionBase {
declare: false;
}
Copy link
Member

Choose a reason for hiding this comment

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

function* foo(): Generator<never, void, unknown>;
//      ^ TS1222: An overload signature cannot be declared as a generator.
function* foo(): Generator<never, void, unknown> { }

playground

Looks like we can exclude and crash on this case as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Huh, TIL.

@bradzacher bradzacher added the awaiting response Issues waiting for a reply from the OP or another party label Jun 4, 2024
@Josh-Cena Josh-Cena requested a review from bradzacher June 4, 2024 06:16
@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Jun 4, 2024
@Josh-Cena Josh-Cena force-pushed the function-decl-ast-invariant branch from 554253f to bee58c7 Compare June 4, 2024 06:17
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

@bradzacher bradzacher changed the title feat(typescript-estree): forbid body, async, generator on declare function feat(typescript-estree): forbid .body, .async, .generator on declare function Jun 4, 2024
@bradzacher bradzacher merged commit 92c8203 into typescript-eslint:main Jun 4, 2024
@Josh-Cena Josh-Cena deleted the function-decl-ast-invariant branch June 4, 2024 06:37
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AST PRs and Issues about the AST structure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AST tightening: TSDeclareFunction has no body, declare function cannot have async or *
2 participants