Skip to content

Conversation

weswigham
Copy link
Member

Followup to #1593 enabling another assertion, which points out a missing ! in isRequiredInitializedParameter.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a critical typo in the isRequiredInitializedParameter function where a missing ! operator was incorrectly negating the strictNullChecks condition. The fix enables a previously disabled assertion that ensures getOptionalType is only called when strict null checks are enabled.

Key changes:

  • Fixed boolean logic in isRequiredInitializedParameter by adding the missing ! operator
  • Re-enabled an assertion in getOptionalType that was commented out due to the bug

Reviewed Changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated no comments.

File Description
internal/checker/emitresolver.go Fixed the typo by adding missing ! operator to strictNullChecks condition
internal/checker/checker.go Re-enabled assertion that ensures getOptionalType is only called with strict null checks
Multiple test baseline files Updated test baselines showing corrected type emission behavior, particularly around parameter type declarations with `

Comment on lines +80 to +82
export declare function fnWithPartialAnnotationOnDefaultparam(x: {
name: string;
} | undefined, b: number): void;
Copy link
Member

Choose a reason for hiding this comment

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

Interesting that we are losing P here; I assume this is a reuse problem?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep - we just swapped the diff caused by lacking node reuse logic from the strict: false case to strict: true.

@weswigham weswigham added this pull request to the merge queue Aug 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Aug 19, 2025
@weswigham weswigham added this pull request to the merge queue Aug 19, 2025
Merged via the queue into microsoft:main with commit 4ddea0c Aug 19, 2025
22 checks passed
@weswigham weswigham deleted the decl-typo-invert branch August 19, 2025 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants