Skip to content
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

feat(typescript): Align isolatedDeclaration implementation with tsc #9715

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

CPunisher
Copy link
Contributor

@CPunisher CPunisher commented Nov 5, 2024

Description:

  • Basic implementation. This also includes diagnostics and type inference.
    • Function
    • Class
    • Variable declaration
    • Enum
  • Remove unused imports and declarations. Based on the result ast of fast dts transformation, we collect the usage of ids which also contain syntax context. Then we prune the ast to cut off the unused imports and declarations.
  • Port tests. To ensure correctness, I'd like to port the fixtures as oxc does https://github.com/oxc-project/oxc/tree/main/crates/oxc_isolated_declarations/tests/fixtures.
  • Benmarks

BREAKING CHANGE:
It will change most of the generated results of d.ts.

Related issue (if exists):
closes #9705
closes #9718

Copy link

changeset-bot bot commented Nov 5, 2024

⚠️ No Changeset found

Latest commit: e6e11e9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@CPunisher CPunisher changed the title feat(typescript): remove unused import in isolatedDeclaration feat(typescript): remove unused imports and declarations in isolatedDeclaration Nov 5, 2024
@SoonIter
Copy link

SoonIter commented Nov 5, 2024

thanks for your help❤️️

😂 got another blocking point of isolatedDeclaration

should generate the same error as tsc

src/App.tsx(8,10): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations.

I'll open another issue

Copy link

codspeed-hq bot commented Nov 5, 2024

CodSpeed Performance Report

Merging #9715 will improve performances by 9.3%

Comparing CPunisher:feat/isolated-decl-minify (5f74590) with main (6ad0735)

Summary

⚡ 1 improvements
✅ 193 untouched benchmarks

Benchmarks breakdown

Benchmark main CPunisher:feat/isolated-decl-minify Change
es/full/base/fixer 127.4 µs 116.6 µs +9.3%

@CPunisher CPunisher changed the title feat(typescript): remove unused imports and declarations in isolatedDeclaration feat(typescript): align tsc isolatedDeclaration Nov 12, 2024
@CPunisher CPunisher changed the title feat(typescript): align tsc isolatedDeclaration feat(typescript): align isolatedDeclaration implementation with tsc Nov 12, 2024
@CPunisher CPunisher changed the title feat(typescript): align isolatedDeclaration implementation with tsc feat(typescript): Align isolatedDeclaration implementation with tsc Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants