@servicenow/sdk - v4.4.1
    Preparing search index...
    interface FunctionLikeDeclaration {
        addClass(
            structure: OptionalKind<ClassDeclarationStructure>,
        ): ClassDeclaration;
        addClasses(
            structures: readonly OptionalKind<ClassDeclarationStructure>[],
        ): ClassDeclaration[];
        addEnum(structure: OptionalKind<EnumDeclarationStructure>): EnumDeclaration;
        addEnums(
            structures: readonly OptionalKind<EnumDeclarationStructure>[],
        ): EnumDeclaration[];
        addFunction(
            structure: OptionalKind<FunctionDeclarationStructure>,
        ): FunctionDeclaration;
        addFunctions(
            structures: readonly OptionalKind<FunctionDeclarationStructure>[],
        ): FunctionDeclaration[];
        addInterface(
            structure: OptionalKind<InterfaceDeclarationStructure>,
        ): InterfaceDeclaration;
        addInterfaces(
            structures: readonly OptionalKind<InterfaceDeclarationStructure>[],
        ): InterfaceDeclaration[];
        addJsDoc(
            structure: string | WriterFunction | OptionalKind<JSDocStructure>,
        ): JSDoc;
        addJsDocs(
            structures: readonly (
                string
                | WriterFunction
                | OptionalKind<JSDocStructure>
            )[],
        ): JSDoc[];
        addModule(
            structure: OptionalKind<ModuleDeclarationStructure>,
        ): ModuleDeclaration;
        addModules(
            structures: readonly OptionalKind<ModuleDeclarationStructure>[],
        ): ModuleDeclaration[];
        addParameter(
            structure: OptionalKind<ParameterDeclarationStructure>,
        ): ParameterDeclaration;
        addParameters(
            structures: readonly OptionalKind<ParameterDeclarationStructure>[],
        ): ParameterDeclaration[];
        addStatements(
            statements:
                | string
                | WriterFunction
                | readonly (string | WriterFunction | StatementStructures)[],
        ): Statement<tsc.Statement>[];
        addTypeAlias(
            structure: OptionalKind<TypeAliasDeclarationStructure>,
        ): TypeAliasDeclaration;
        addTypeAliases(
            structures: readonly OptionalKind<TypeAliasDeclarationStructure>[],
        ): TypeAliasDeclaration[];
        addTypeParameter(
            structure: string | OptionalKind<TypeParameterDeclarationStructure>,
        ): TypeParameterDeclaration;
        addTypeParameters(
            structures: readonly (
                string
                | OptionalKind<TypeParameterDeclarationStructure>
            )[],
        ): TypeParameterDeclaration[];
        addVariableStatement(
            structure: OptionalKind<VariableStatementStructure>,
        ): VariableStatement;
        addVariableStatements(
            structures: readonly OptionalKind<VariableStatementStructure>[],
        ): VariableStatement[];
        getClass(name: string): ClassDeclaration | undefined;
        getClass(
            findFunction: (declaration: ClassDeclaration) => boolean,
        ): ClassDeclaration | undefined;
        getClasses(): ClassDeclaration[];
        getClassOrThrow(name: string): ClassDeclaration;
        getClassOrThrow(
            findFunction: (declaration: ClassDeclaration) => boolean,
        ): ClassDeclaration;
        getEnum(name: string): EnumDeclaration | undefined;
        getEnum(
            findFunction: (declaration: EnumDeclaration) => boolean,
        ): EnumDeclaration | undefined;
        getEnumOrThrow(name: string): EnumDeclaration;
        getEnumOrThrow(
            findFunction: (declaration: EnumDeclaration) => boolean,
        ): EnumDeclaration;
        getEnums(): EnumDeclaration[];
        getFirstModifierByKind<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): KindToNodeMappings[TKind] | undefined;
        getFirstModifierByKindOrThrow<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): KindToNodeMappings[TKind];
        getFunction(name: string): FunctionDeclaration | undefined;
        getFunction(
            findFunction: (declaration: FunctionDeclaration) => boolean,
        ): FunctionDeclaration | undefined;
        getFunctionOrThrow(name: string): FunctionDeclaration;
        getFunctionOrThrow(
            findFunction: (declaration: FunctionDeclaration) => boolean,
        ): FunctionDeclaration;
        getFunctions(): FunctionDeclaration[];
        getInterface(name: string): InterfaceDeclaration | undefined;
        getInterface(
            findFunction: (declaration: InterfaceDeclaration) => boolean,
        ): InterfaceDeclaration | undefined;
        getInterfaceOrThrow(name: string): InterfaceDeclaration;
        getInterfaceOrThrow(
            findFunction: (declaration: InterfaceDeclaration) => boolean,
        ): InterfaceDeclaration;
        getInterfaces(): InterfaceDeclaration[];
        getJsDocs(): JSDoc[];
        getModifiers(): Node<Modifier>[];
        getModule(name: string): ModuleDeclaration | undefined;
        getModule(
            findFunction: (declaration: ModuleDeclaration) => boolean,
        ): ModuleDeclaration | undefined;
        getModuleOrThrow(name: string): ModuleDeclaration;
        getModuleOrThrow(
            findFunction: (declaration: ModuleDeclaration) => boolean,
        ): ModuleDeclaration;
        getModules(): ModuleDeclaration[];
        getParameter(name: string): ParameterDeclaration | undefined;
        getParameter(
            findFunction: (declaration: ParameterDeclaration) => boolean,
        ): ParameterDeclaration | undefined;
        getParameterOrThrow(name: string): ParameterDeclaration;
        getParameterOrThrow(
            findFunction: (declaration: ParameterDeclaration) => boolean,
        ): ParameterDeclaration;
        getParameters(): ParameterDeclaration[];
        getReturnType(): Type;
        getReturnTypeNode(): TypeNode<tsc.TypeNode> | undefined;
        getReturnTypeNodeOrThrow(message?: string | (() => string)): TypeNode;
        getSignature(): Signature;
        getStatement<T extends Statement<tsc.Statement>>(
            findFunction: (statement: Statement) => statement is T,
        ): T | undefined;
        getStatement(
            findFunction: (statement: Statement) => boolean,
        ): Statement<tsc.Statement> | undefined;
        getStatementByKind<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): KindToNodeMappingsWithCommentStatements[TKind] | undefined;
        getStatementByKindOrThrow<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): KindToNodeMappingsWithCommentStatements[TKind];
        getStatementOrThrow<T extends Statement<tsc.Statement>>(
            findFunction: (statement: Statement) => statement is T,
        ): T;
        getStatementOrThrow(
            findFunction: (statement: Statement) => boolean,
        ): Statement;
        getStatements(): Statement<tsc.Statement>[];
        getStatementsWithComments(): Statement<tsc.Statement>[];
        getTypeAlias(name: string): TypeAliasDeclaration | undefined;
        getTypeAlias(
            findFunction: (declaration: TypeAliasDeclaration) => boolean,
        ): TypeAliasDeclaration | undefined;
        getTypeAliases(): TypeAliasDeclaration[];
        getTypeAliasOrThrow(name: string): TypeAliasDeclaration;
        getTypeAliasOrThrow(
            findFunction: (declaration: TypeAliasDeclaration) => boolean,
        ): TypeAliasDeclaration;
        getTypeParameter(name: string): TypeParameterDeclaration | undefined;
        getTypeParameter(
            findFunction: (declaration: TypeParameterDeclaration) => boolean,
        ): TypeParameterDeclaration | undefined;
        getTypeParameterOrThrow(name: string): TypeParameterDeclaration;
        getTypeParameterOrThrow(
            findFunction: (declaration: TypeParameterDeclaration) => boolean,
        ): TypeParameterDeclaration;
        getTypeParameters(): TypeParameterDeclaration[];
        getVariableDeclaration(name: string): VariableDeclaration | undefined;
        getVariableDeclaration(
            findFunction: (declaration: VariableDeclaration) => boolean,
        ): VariableDeclaration | undefined;
        getVariableDeclarationOrThrow(name: string): VariableDeclaration;
        getVariableDeclarationOrThrow(
            findFunction: (declaration: VariableDeclaration) => boolean,
        ): VariableDeclaration;
        getVariableDeclarations(): VariableDeclaration[];
        getVariableStatement(name: string): VariableStatement | undefined;
        getVariableStatement(
            findFunction: (declaration: VariableStatement) => boolean,
        ): VariableStatement | undefined;
        getVariableStatementOrThrow(name: string): VariableStatement;
        getVariableStatementOrThrow(
            findFunction: (declaration: VariableStatement) => boolean,
        ): VariableStatement;
        getVariableStatements(): VariableStatement[];
        hasModifier(kind: tsc.SyntaxKind): boolean;
        hasModifier(text: ModifierTexts): boolean;
        insertClass(
            index: number,
            structure: OptionalKind<ClassDeclarationStructure>,
        ): ClassDeclaration;
        insertClasses(
            index: number,
            structures: readonly OptionalKind<ClassDeclarationStructure>[],
        ): ClassDeclaration[];
        insertEnum(
            index: number,
            structure: OptionalKind<EnumDeclarationStructure>,
        ): EnumDeclaration;
        insertEnums(
            index: number,
            structures: readonly OptionalKind<EnumDeclarationStructure>[],
        ): EnumDeclaration[];
        insertFunction(
            index: number,
            structure: OptionalKind<FunctionDeclarationStructure>,
        ): FunctionDeclaration;
        insertFunctions(
            index: number,
            structures: readonly OptionalKind<FunctionDeclarationStructure>[],
        ): FunctionDeclaration[];
        insertInterface(
            index: number,
            structure: OptionalKind<InterfaceDeclarationStructure>,
        ): InterfaceDeclaration;
        insertInterfaces(
            index: number,
            structures: readonly OptionalKind<InterfaceDeclarationStructure>[],
        ): InterfaceDeclaration[];
        insertJsDoc(
            index: number,
            structure: string | WriterFunction | OptionalKind<JSDocStructure>,
        ): JSDoc;
        insertJsDocs(
            index: number,
            structures: readonly (
                string
                | WriterFunction
                | OptionalKind<JSDocStructure>
            )[],
        ): JSDoc[];
        insertModule(
            index: number,
            structure: OptionalKind<ModuleDeclarationStructure>,
        ): ModuleDeclaration;
        insertModules(
            index: number,
            structures: readonly OptionalKind<ModuleDeclarationStructure>[],
        ): ModuleDeclaration[];
        insertParameter(
            index: number,
            structure: OptionalKind<ParameterDeclarationStructure>,
        ): ParameterDeclaration;
        insertParameters(
            index: number,
            structures: readonly OptionalKind<ParameterDeclarationStructure>[],
        ): ParameterDeclaration[];
        insertStatements(
            index: number,
            statements:
                | string
                | WriterFunction
                | readonly (string | WriterFunction | StatementStructures)[],
        ): Statement<tsc.Statement>[];
        insertTypeAlias(
            index: number,
            structure: OptionalKind<TypeAliasDeclarationStructure>,
        ): TypeAliasDeclaration;
        insertTypeAliases(
            index: number,
            structures: readonly OptionalKind<TypeAliasDeclarationStructure>[],
        ): TypeAliasDeclaration[];
        insertTypeParameter(
            index: number,
            structure: string | OptionalKind<TypeParameterDeclarationStructure>,
        ): TypeParameterDeclaration;
        insertTypeParameters(
            index: number,
            structures: readonly (
                string
                | OptionalKind<TypeParameterDeclarationStructure>
            )[],
        ): TypeParameterDeclaration[];
        insertVariableStatement(
            index: number,
            structure: OptionalKind<VariableStatementStructure>,
        ): VariableStatement;
        insertVariableStatements(
            index: number,
            structures: readonly OptionalKind<VariableStatementStructure>[],
        ): VariableStatement[];
        removeReturnType(): this;
        removeStatement(index: number): this;
        removeStatements(indexRange: [number, number]): this;
        setReturnType(textOrWriterFunction: string | WriterFunction): this;
        toggleModifier(text: ModifierTexts, value?: boolean): this;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • Gets the JS doc nodes.

      Returns JSDoc[]

    • Gets the return type node or throws if none exists.

      Parameters

      • Optionalmessage: string | (() => string)

      Returns TypeNode

    • Gets the first statement that matches the provided condition or returns undefined if it doesn't exist.

      Type Parameters

      Parameters

      • findFunction: (statement: Statement) => statement is T

        Function to find the statement by.

      Returns T | undefined

    • Gets the first statement that matches the provided condition or returns undefined if it doesn't exist.

      Parameters

      • findFunction: (statement: Statement) => boolean

        Function to find the statement by.

      Returns Statement<tsc.Statement> | undefined

    • Gets the first statement that matches the provided condition or throws if it doesn't exist.

      Type Parameters

      Parameters

      • findFunction: (statement: Statement) => statement is T

        Function to find the statement by.

      Returns T

    • Gets the first statement that matches the provided condition or throws if it doesn't exist.

      Parameters

      • findFunction: (statement: Statement) => boolean

        Function to find the statement by.

      Returns Statement

    • Gets all the variable declarations within the variable statement children.

      Returns VariableDeclaration[]

      This does not return the variable declarations within for statements or for of statements.

    • Gets if it has the specified modifier.

      Parameters

      Returns boolean

    • Gets if it has the specified modifier.

      Parameters

      Returns boolean

    • Removes the return type.

      Returns this

    • Removes the statement at the specified index.

      Parameters

      • index: number

        Child index to remove the statement at.

      Returns this

    • Removes the statements at the specified index range.

      Parameters

      • indexRange: [number, number]

        The start and end inclusive index range to remove.

      Returns this

    • Sets the return type of the node.

      Parameters

      • textOrWriterFunction: string | WriterFunction

        Text or writer function to set the return type with.

      Returns this

    • Toggles a modifier.

      Parameters

      • text: ModifierTexts

        Text to toggle the modifier for.

      • Optionalvalue: boolean

        Optional toggling value.

      Returns this