Skip to content

Comments

fix(isolated-declarations): optional parameter property misses undefined type#12579

Merged
graphite-app[bot] merged 1 commit intomainfrom
07-28-fix_isolated-declarations_handle_optional_parameter_properties_in_private_constructors
Jul 28, 2025
Merged

fix(isolated-declarations): optional parameter property misses undefined type#12579
graphite-app[bot] merged 1 commit intomainfrom
07-28-fix_isolated-declarations_handle_optional_parameter_properties_in_private_constructors

Conversation

@Dunqing
Copy link
Member

@Dunqing Dunqing commented Jul 28, 2025

TypeScript Playground

Input:

export class PrivateConstructorWithOptionalParameters {
	private constructor(
		required: string,
		optional?: number,
		public publicOptional?: boolean,
		private privateOptional?: string,
		readonly readonlyOptional?: number,
	) {}
}

Output:

export declare class PrivateConstructorWithOptionalParameters {
    publicOptional?: boolean | undefined;
    private privateOptional?;
    readonly readonlyOptional?: number | undefined;
    private constructor();
}

optional parameter property should union the original type with undefined

@github-actions github-actions bot added A-isolated-declarations Isolated Declarations C-bug Category - Bug labels Jul 28, 2025
Copy link
Member Author

Dunqing commented Jul 28, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq
Copy link

codspeed-hq bot commented Jul 28, 2025

CodSpeed Instrumentation Performance Report

Merging #12579 will not alter performance

Comparing 07-28-fix_isolated-declarations_handle_optional_parameter_properties_in_private_constructors (3cdac4c) with main (3489ce0)1

Summary

✅ 34 untouched benchmarks

Footnotes

  1. No successful run was found on 07-28-fix_isolated-declarations_crash_when_transforming_a_class_with_a_parameter_property_in_a_private_constructor (4f9cb0b) during the generation of this report, so main (3489ce0) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Jul 28, 2025
Copy link
Member

Boshen commented Jul 28, 2025

Merge activity

…ined` type (#12579)

[TypeScript Playground](https://www.typescriptlang.org/play/?#code/KYDwDg9gTgLgBAYwDYEMDOa4AUoEsBuKMwAwhAHZoxQCuCM0A6rjABYDyYMuFKSWKKCgC2wYlEwBvAFABIMHkLFEFKrXrQAFHNlRgARxq49AEwBccNbnIBzADQ6IXHuT4B+C+RrCARsCgOsvI0Pki4CHBgIWEInNy8SB5wPhAQSMAo5IHyikTAkbnEcS7uFla22XooJhRIAJ5wVTXk9cUJSV6+-oEAlHCSAL7SA0A)

Input:
```ts
export class PrivateConstructorWithOptionalParameters {
	private constructor(
		required: string,
		optional?: number,
		public publicOptional?: boolean,
		private privateOptional?: string,
		readonly readonlyOptional?: number,
	) {}
}
```

Output:

```ts
export declare class PrivateConstructorWithOptionalParameters {
    publicOptional?: boolean | undefined;
    private privateOptional?;
    readonly readonlyOptional?: number | undefined;
    private constructor();
}
```

optional parameter property should union the original type with `undefined`
@graphite-app graphite-app bot force-pushed the 07-28-fix_isolated-declarations_crash_when_transforming_a_class_with_a_parameter_property_in_a_private_constructor branch from c93fff5 to 4f9cb0b Compare July 28, 2025 13:23
@graphite-app graphite-app bot force-pushed the 07-28-fix_isolated-declarations_handle_optional_parameter_properties_in_private_constructors branch from 6ecb231 to 3cdac4c Compare July 28, 2025 13:23
Base automatically changed from 07-28-fix_isolated-declarations_crash_when_transforming_a_class_with_a_parameter_property_in_a_private_constructor to main July 28, 2025 13:31
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jul 28, 2025
@graphite-app graphite-app bot merged commit 3cdac4c into main Jul 28, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 07-28-fix_isolated-declarations_handle_optional_parameter_properties_in_private_constructors branch July 28, 2025 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-isolated-declarations Isolated Declarations C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants