Custom TypeScript plugin to generate a dynamic type registery for a factory method #5294
Replies: 1 comment
-
It seems that local TS plugins cannot be loaded. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am trying to generate a dynamic type definition for a factory method.
Here's a bit of context:
This is in a large project that is structured into small modules.
A module service exposes the method "useModule", which accepts a module identifier as a string.
At the moment, each time I call this method I need to explicitely tell TypeScript which module it is with something as this:
I would like to dynamically generate a type file with a registery of all available modules and use it in the module service to automatically infer the return type of "useModule" from the module id.
I have tried creating a custom TypeScript plugin and add it to "tsconfig.app.json" or "tsconfig.json" as followes, but the plugin doesn't seem to be called:
#483 seems to indicate that confmlicts can occur between various plugins, but there are no other plugins defined in my tsconfig.json, and
vue-tsc --showConfig
doesn't show any other plugins.Am I doing something wrong?
Or is there a better way of dealing with my issue?
Thank you very much in advance.
Beta Was this translation helpful? Give feedback.
All reactions