Open gepz opened 2 years ago
It's likely this is a typescript issue rather than a ts-loader/webpack one. ts-loader uses the export from TSC - probably worth looking there first.
I'm not sure how to reproduce this with tsc only. Does ts-loader/webpack use anything else from tsc other than the generated js and declaration files that can be obtained by running tsc cli?
Just run tsc
over your source files. It ships with the TypeScript npm package
I encountered this issue when beginning to use the satisfies
keyword for the first time in a WebPack project. I've narrowed it down to the smallest example of the bug occurring. Please see the following repo:
https://github.com/cjdell/ts-loader-satisfies-bug
Hope this is of help. Let me know if you want me to clarify anything. Also thank you to all contributors for giving this your valuable attention.
Thanks for sharing a reproduction - I don't have bandwidth to look at it at present but I encourage others to do so. I'm surprised this is occurring as TSC should be stripping this
Thanks @johnnyreilly. I actually have since narrowed it down further and I'm invoking the TS compile just as ts-loader
does and it behaves the same way. Looks like a legitimate TS bug. Your instincts were correct. I will raise the issue on the TS repo. Thanks for replying so quickly.
No worries!
Link to the TypeScript issue for anyone following this: https://github.com/microsoft/TypeScript/issues/51642
Looks like this will be fixed very shortly... :-) https://github.com/microsoft/TypeScript/pull/51704
I hope you're satisfies
@cjdell 😅
Expected Behaviour
Output file is bundled correctly.
Actual Behaviour
The output file index.js only contains the 2 lines of the compiled entry file without bundling anything.
Steps to Reproduce the Problem
Import anything and use it in export default, Then add "satisfies Readonly" or satisfies any other generic type at the end
This only happens when export default satisfies a generic type, "satisfies unknown" or "satisfies () => void" work correctly.
Dependencies:
Location of a Minimal Repository that Demonstrates the Issue.