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)   Add type members as values of this map, using standard keys.
arrayOfKind(kind)   Get type members of a particular kind.
clone()   Get a clone of this map.
convertAccessorsToProperty(name)   Convert get and/or set accessors to a property. This may be lossy, but we try to be faithful.
convertPropertyToAccessors(name, toGetter, toSetter)   Convert a property signature to get and/or set accessors. This may be lossy, but we try to be faithful.
fromMemberedObject(membered) static Create a TypeMembersMap from an interface or membered object.
getAsKind(kind, name)   A typed call to this.get() for a given kind.
keyFromMember(member) static Get a map key from a potential type member.
keyFromName(kind, name) static  
moveMembersToType(owner)   Move type members from this map to an interface or type literal, and clear this map.
resolveIndexSignature(signature, names)   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()