import { LineResults } from "../LineResults" ; import { CommandNames } from "../Names/CommandNames" ; import { Command } from "./Command" ; import { CommandMetadata } from "./Metadata/CommandMetadata" ; import { SingleParameter } from "./Metadata/Parameters/SingleParameter" ; /**
 * Declares a list type.
 */ export class ListTypeCommand extends Command { /**
     * Metadata on the command.
     */ private static metadata : CommandMetadata = new CommandMetadata ( CommandNames . ListType ) . withDescription ( "Declares a list type" ) . withParameters ( [ new SingleParameter ( "type" , "The type of the list" , true ) ] ) ; returns public getMetadata ( ) { return ListTypeCommand . metadata ; } param parameters returns public render ( parameters ) { const typeNameLine = this . context . convertParsed ( [ CommandNames . Type , parameters [ 1 ] ] ) ; const typeNameRaw = typeNameLine . commandResults [ 0 ] . text ; let typeName ; if ( this . language . syntax . lists . asArray ) { typeName = typeNameRaw + "[]" ; } else { typeName = this . language . syntax . lists . className + "<" + typeNameRaw + ">" ; } return LineResults . newSingleLine ( typeName ) . withImports ( this . language . syntax . lists . requiredImports ) . withImports ( typeNameLine . addedImports ) ; } }