Skip to content

Conversation

@ulivz
Copy link
Member

@ulivz ulivz commented Feb 2, 2025

Summary

Currently @electron-toolkit/tsconfig[1] sets moduleResolution to node, and electron-store[2] is implemented based on conf[3]. Currently conf exports types based on exports.types:

"exports": {
	"types": "./dist/source/index.d.ts",
	"default": "./dist/source/index.js"
},

The current setup ("moduleResolution": "node" ) cannot properly handle the types field in exports[4], so that tsc to be unable to recognize these types.

This PR enables moduleResolution: bundler[5] to remove all @ts-ignores.

References

[1] https://github.com/alex8088/electron-toolkit/blob/master/packages/tsconfig/tsconfig.json#L10
[2] https://github.com/sindresorhus/electron-store/blob/main/package.json
[3] https://github.com/sindresorhus/conf/blob/main/package.json
[4] https://www.typescriptlang.org/tsconfig/#moduleResolution
[5] microsoft/TypeScript#51669, https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution-for-libraries

@ulivz ulivz requested a review from ycjcl868 February 2, 2025 16:42
@ulivz ulivz force-pushed the infra/enable-moduleResolution-bundler branch from a766950 to 4ca7538 Compare February 2, 2025 16:44
@codecov
Copy link

codecov bot commented Feb 2, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 16.50%. Comparing base (336a951) to head (2db4fc3).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/main/store/setting.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #78   +/-   ##
=======================================
  Coverage   16.50%   16.50%           
=======================================
  Files          47       47           
  Lines        1218     1218           
  Branches      193      193           
=======================================
  Hits          201      201           
  Misses        994      994           
  Partials       23       23           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ulivz ulivz force-pushed the infra/enable-moduleResolution-bundler branch from 4ca7538 to 2db4fc3 Compare February 2, 2025 17:04
@ycjcl868 ycjcl868 merged commit 99319b4 into main Feb 3, 2025
9 of 10 checks passed
@ycjcl868 ycjcl868 deleted the infra/enable-moduleResolution-bundler branch February 3, 2025 01:23
@ycjcl868 ycjcl868 mentioned this pull request Feb 8, 2025
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