You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The union types extracted from TypeScript declaration files are possibly unstable.
In rspack, we run API checks using api-extractor to ensure the API change is correct. The result shows the union type is not ordered (or sorted), causing the snapshot being not usable. The result of an diff command for both etc and temp file.
Repro steps
It's hard to reproduce as this is related to some internal declaration inlining logics.
Expected result:
The union output should be stable.
Actual result:
The union output is not stable.
Details
As what has been discussed in microsoft/TypeScript#17944 issue, tsc does not seem to provide the stable output for the union type. Potential fix might be sorting the output of the union types like microsoft/TypeScript#32224, but I don't know whether it's good to ship it in on the tsc side or on the api-extractor side. If you have any possible recommended solution on this one, please let me know.
Summary
The union types extracted from TypeScript declaration files are possibly unstable.
In rspack, we run API checks using api-extractor to ensure the API change is correct. The result shows the union type is not ordered (or sorted), causing the snapshot being not usable. The result of an
diff
command for bothetc
andtemp
file.Repro steps
It's hard to reproduce as this is related to some internal declaration inlining logics.
Expected result:
The union output should be stable.
Actual result:
The union output is not stable.
Details
As what has been discussed in microsoft/TypeScript#17944 issue, tsc does not seem to provide the stable output for the union type. Potential fix might be sorting the output of the union types like microsoft/TypeScript#32224, but I don't know whether it's good to ship it in on the tsc side or on the api-extractor side. If you have any possible recommended solution on this one, please let me know.
Possible solution: Maybe we could sort the dts before passing to the api-extractor using formatters like https://typescript-eslint.io/rules/sort-type-constituents/.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
@microsoft/api-extractor
version?node -v
)?The text was updated successfully, but these errors were encountered: