Skip to content

fix(isolated-declarations): object property key was generated incorrectly#11231

Merged
graphite-app[bot] merged 1 commit intomainfrom
05-22-fix_isolated-declarations_object_property_key_was_generated_incorrectly
May 23, 2025
Merged

fix(isolated-declarations): object property key was generated incorrectly#11231
graphite-app[bot] merged 1 commit intomainfrom
05-22-fix_isolated-declarations_object_property_key_was_generated_incorrectly

Conversation

@Dunqing
Copy link
Member

@Dunqing Dunqing commented May 22, 2025

Just for aligning with TypeScript, the object key should be converted to a static property key when possible

const ObjectKeys = {
	a: 0,
	["b"]: 1,
	[`c`]: 2,
	[3]: 3,
	[-3]: 4,
	[4n]: 5,
};
declare const ObjectKeys: {
	a: number
	b: number
	c: number
	3: number
	[-3]: number
};

BigInt is invalid as a property key in TypeScript, so 4n doesn't emit.

Copy link
Member Author

Dunqing commented May 22, 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.

@Dunqing Dunqing force-pushed the 05-22-fix_isolated-declarations_object_property_key_was_generated_incorrectly branch from 9674d51 to 797cb04 Compare May 22, 2025 07:50
@Dunqing Dunqing force-pushed the 05-22-feat_isolated-declarations_report_an_error_for_object_methods_whose_return_type_cannot_be_inferred branch from 1cce8d8 to 3198d49 Compare May 22, 2025 07:50
@github-actions github-actions bot added A-isolated-declarations Isolated Declarations C-bug Category - Bug labels May 22, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented May 22, 2025

CodSpeed Instrumentation Performance Report

Merging #11231 will not alter performance

Comparing 05-22-fix_isolated-declarations_object_property_key_was_generated_incorrectly (ac9638e) with 05-22-feat_isolated-declarations_report_an_error_for_object_methods_whose_return_type_cannot_be_inferred (123e63c)

Summary

✅ 38 untouched benchmarks

@Dunqing Dunqing force-pushed the 05-22-feat_isolated-declarations_report_an_error_for_object_methods_whose_return_type_cannot_be_inferred branch from 3198d49 to f8622ef Compare May 22, 2025 23:43
@Dunqing Dunqing force-pushed the 05-22-fix_isolated-declarations_object_property_key_was_generated_incorrectly branch from 797cb04 to 29c8e12 Compare May 22, 2025 23:43
@Dunqing Dunqing marked this pull request as ready for review May 22, 2025 23:51
@Dunqing Dunqing force-pushed the 05-22-fix_isolated-declarations_object_property_key_was_generated_incorrectly branch from 29c8e12 to 57ab474 Compare May 23, 2025 03:24
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label May 23, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented May 23, 2025

Merge activity

…ctly (#11231)

Just for aligning with `TypeScript`, the object key should be converted to a static property key when possible

```ts
const ObjectKeys = {
	a: 0,
	["b"]: 1,
	[`c`]: 2,
	[3]: 3,
	[-3]: 4,
	[4n]: 5,
};
```

```ts
declare const ObjectKeys: {
	a: number
	b: number
	c: number
	3: number
	[-3]: number
};
```

`BigInt` is invalid as a property key in TypeScript, so `4n` doesn't emit.
@graphite-app graphite-app bot force-pushed the 05-22-feat_isolated-declarations_report_an_error_for_object_methods_whose_return_type_cannot_be_inferred branch from f8622ef to 123e63c Compare May 23, 2025 11:52
@graphite-app graphite-app bot force-pushed the 05-22-fix_isolated-declarations_object_property_key_was_generated_incorrectly branch from 57ab474 to ac9638e Compare May 23, 2025 11:52
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label May 23, 2025
Base automatically changed from 05-22-feat_isolated-declarations_report_an_error_for_object_methods_whose_return_type_cannot_be_inferred to main May 23, 2025 11:58
@graphite-app graphite-app bot merged commit ac9638e into main May 23, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 05-22-fix_isolated-declarations_object_property_key_was_generated_incorrectly branch May 23, 2025 11:58
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.

1 participant