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Content":["import { Type } from './abstract';\n\n/**\n * Represents a tuple type.\n *\n * ~~~\n * let value: [string,boolean];\n * ~~~\n */\nexport class TupleType extends Type {\n /**\n * The ordered type elements of the tuple type.\n */\n elements: Type[];\n\n /**\n * The type name identifier.\n */\n readonly type: string = 'tuple';\n\n /**\n * Create a new TupleType instance.\n *\n * @param elements The ordered type elements of the tuple type.\n */\n constructor(elements: Type[]) {\n super();\n this.elements = elements;\n }\n\n /**\n * Clone this type.\n *\n * @return A clone of this type.\n */\n clone(): Type {\n return new TupleType(this.elements);\n }\n\n /**\n * Test whether this type equals the given type.\n *\n * @param type The type that should be checked for equality.\n * @returns TRUE if the given type equals this type, FALSE otherwise.\n */\n equals(type: TupleType): boolean {\n if (!(type instanceof TupleType)) {\n return false;\n }\n return Type.isTypeListEqual(type.elements, this.elements);\n }\n\n /**\n * Return a raw object representation of this type.\n * @deprecated Use serializers instead\n */\n toObject(): any {\n const result: any = super.toObject();\n\n if (this.elements && this.elements.length) {\n result.elements = this.elements.map((e) => e.toObject());\n }\n\n return result;\n }\n\n /**\n * Return a string representation of this type.\n */\n toString() {\n const names: string[] = [];\n this.elements.forEach((element) => {\n names.push(element.toString());\n });\n\n return '[' + names.join(', ') + ']';\n }\n}\n"]}
\No newline at end of file