es-membrane

Home > ts-morph-structures > TypeMembersMap

TypeMembersMap class

A map for members of InterfaceDeclarationImpl and MemberedObjectTypeStructureImpl. This doesn’t replace the structures, rather it _feeds_ them.

Signature:

export default class TypeMembersMap extends OrderedMap<string, TypeMemberImpl> 

Extends: OrderedMap<string, TypeMemberImpl>

Example

const map = new TypeMembersMap; const foo = new PropertySignatureImpl(false, “foo”); map.addMembers([foo]); // … const interfaceDecl = new InterfaceDeclarationImpl(“FooInterface”); map.moveMembersToType(interfaceDecl); // interfaceDecl.properties === [foo];

Methods

Method Modifiers Description
[addMembers(members)](/es-membrane/ts-morph-structures/api/ts-morph-structures.typemembersmap.addmembers.html) Add type members as values of this map, using standard keys.
[arrayOfKind(kind)](/es-membrane/ts-morph-structures/api/ts-morph-structures.typemembersmap.arrayofkind.html) Get type members of a particular kind.
[clone()](/es-membrane/ts-morph-structures/api/ts-morph-structures.typemembersmap.clone.html) Get a clone of this map.
[convertAccessorsToProperty(name)](/es-membrane/ts-morph-structures/api/ts-morph-structures.typemembersmap.convertaccessorstoproperty.html) Convert get and/or set accessors to a property. This may be lossy, but we try to be faithful.
[convertPropertyToAccessors(name, toGetter, toSetter)](/es-membrane/ts-morph-structures/api/ts-morph-structures.typemembersmap.convertpropertytoaccessors.html) Convert a property signature to get and/or set accessors. This may be lossy, but we try to be faithful.
[fromMemberedObject(membered)](/es-membrane/ts-morph-structures/api/ts-morph-structures.typemembersmap.frommemberedobject.html) `static` Create a `TypeMembersMap` from an interface or membered object.
[getAsKind(kind, name)](/es-membrane/ts-morph-structures/api/ts-morph-structures.typemembersmap.getaskind.html) A typed call to `this.get()` for a given kind.
[keyFromMember(member)](/es-membrane/ts-morph-structures/api/ts-morph-structures.typemembersmap.keyfrommember.html) `static` Get a map key from a potential type member.
[keyFromName(kind, name)](/es-membrane/ts-morph-structures/api/ts-morph-structures.typemembersmap.keyfromname.html) `static`
[moveMembersToType(owner)](/es-membrane/ts-morph-structures/api/ts-morph-structures.typemembersmap.movememberstotype.html) Move type members from this map to an interface or type literal, and clear this map.
[resolveIndexSignature(signature, names)](/es-membrane/ts-morph-structures/api/ts-morph-structures.typemembersmap.resolveindexsignature.html) Replace an index signature with other methods/properties matching the signature's return type. It is up to you to ensure the names match the key type of the index signature.
[toJSON()](/es-membrane/ts-morph-structures/api/ts-morph-structures.typemembersmap.tojson.html)