class-factory mixins in type declaration files are impossible. (allow implicit return types in declaration files somehow) #35715
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
Search Terms
When the compiler is set to emit declaration files, class-factory mixins are no longer allowed. This is yet another issue that prevents class-factory mixins from being adopted in library code that need to be publish as JS with sibling declaration files.
Suggestion
Allow implicit return types to be somehow representable in declaration files.
Use Cases
Enables many use cases that are otherwise impossible when emitting declaration files. I believe declaration files should support all features of TS.
Examples
Write a mixin function, and try to emit declaration files.
Workaround
As a workaround I publish TypeScript source files in my NPM packages, then I point the
types
field inpackage.json
to my source entry point. I don't publish declaration files because I can't build them.Pointing to source files opens up other cans of worms, and prior to TS 3.6.3 I was not able to point to source files due to pre-existing bugs in
tsc
in that scenario. After TS 3.6.3, I can successfully publish source files and pointtypes
to sources containing class-factory mixins, but I'm afraid this is brittle and can break with an upgrade to TS (just as it was broken from some point prior to v3.6.3).Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: