ts-morph icon indicating copy to clipboard operation
ts-morph copied to clipboard

No MappedTypeNode definition in ts-morph

Open ooyyloo opened this issue 5 years ago • 3 comments

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.

ooyyloo avatar Dec 02 '19 02:12 ooyyloo

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?

nicdard avatar Apr 15 '21 20:04 nicdard

@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.

dsherret avatar Apr 15 '21 20:04 dsherret

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

nicdard avatar Apr 15 '21 21:04 nicdard