dsherret / ts-morph

TypeScript Compiler API wrapper for static analysis and programmatic code changes.
https://ts-morph.com
MIT License
4.87k stars 194 forks source link

No MappedTypeNode definition in ts-morph #769

Open ooyyloo opened 4 years ago

ooyyloo commented 4 years ago

Is your feature request related to a problem? Please describe.

No MappedTypeNode definition in ts-morph. No TypeQueryNode definition in ts-morph. No TypeOperatorNode definition in ts-morph.

nicdard commented 3 years ago

Is this still open? In case, I would like to help :) However, since it would be my first contribution, can you give me some more guidance?

dsherret commented 3 years ago

@nicdard yup and that would be great!

  1. Create a basic wrapped MappedTypeNode in this directory: https://github.com/dsherret/ts-morph/tree/latest/packages/ts-morph/src/compiler/ast/type (base should be TypedNode... see here for the typescript AST node: https://github.com/dsherret/ts-morph/blob/1dc592141432f8e0541b7b6211f7edf8ad205e5a/packages/common/lib/typescript.d.ts#L947)
  2. Update https://github.com/dsherret/ts-morph/blob/latest/packages/ts-morph/src/factories/kindToWrapperMappings.ts to have the mapping from ts.SyntaxKind.MappedType to MappedTypeNode.
  3. Run yarn code-generate in packages/ts-morph. This will generate a lot of the code for you.
  4. Start adding helper methods and write tests for these methods similar to how the other nodes are done.

Maybe just start with methods for navigation then after if you would like you can do methods for manipulating the text.

nicdard commented 3 years ago

Thank you for the guidance and fast answer! I'll try my best!