Extend createMethodSignature and updateMethodSignature with 'modifiers' argument #35959
Open
5 tasks done
Labels
API
Relates to the public API for TypeScript
In Discussion
Not yet reached consensus
Suggestion
An idea for TypeScript
Search Terms
updateMethodSignature, createMethodSignature
Suggestion
It should be possible to provide an array of Modifiers (or
undefined
) to thecreateMethodSignature
andupdateMethodSignature
functions.Use Cases
When using the TypeScript compiler APIs, TypeScript provides numerous
create
andupdate
functions that can be used to generate an AST, for example from Custom Transformers. However, forMethodSignature
s, which may have modifiers such as thestatic
keyword, there's no option to create or update their modifiers. This breaks one of my libraries which sole purpose is to simply deep-clone a TypeScript node. A workaround is to manually patch the modifiers, however I hope this can be part of the function (as it is for others, likecreatePropertySignature
andupdatePropertySignature
).Examples
However, the above example would be a breaking change since the first parameter expects a NodeArray of type parameters, so an alternative solution would be to accept it as the last argument.
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: