We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
situation:
sometimes i wish i could generate a piece of code based on some existing one, for example a construction function for an given interface
interface MyConfig { name: string; values: number[]; } function myConfigFrom(name: string, values: number[]) : MyConfig { return { name, values }; }
problem: currently my options are
solution:
allow AST rewrites via decorators
@rewrite(addContructorFunction) interface MyConfig { name: string; values: number[]; } function addContructorFunction(node: ts.Node): ts.Node[] { return [node, toConstructorFunction(node as ts.InterfaceDeclaration)]; } function toConstructorFunction(node: ts.IntefaceDeclaration): ts.FunctionDeclaration { // fun stuff goes here }
The text was updated successfully, but these errors were encountered:
This is a duplicate of #4892, although with a decorator mechanism instead. Can you add your proposal to that discussion instead?
Sorry, something went wrong.
ok
Also a little like #2900, except with that idea you'd still have to write your own code generator.
No branches or pull requests
situation:
sometimes i wish i could generate a piece of code based on some existing one, for example a construction function for an given interface
problem: currently my options are
solution:
allow AST rewrites via decorators
The text was updated successfully, but these errors were encountered: