Flow Connect Help
Roadmap
  • ℹ️This is Flow Connect
    • Overview
    • Technical overview
      • System requirements
    • What's new?
      • Change log
  • ▶️quick start
    • Create an application
    • Create an admin access group
  • 🔁working with Connect
    • Connect to systems
      • Connector agents
        • Add agent group
        • Install agent manager
        • Add agent
        • Manage agent
      • Connectors
        • IFS Applications 10
        • Oracle
        • Microsoft SQL Server
        • Send Email
        • REST
          • Microsoft Graph API
          • Infor M3 REST
            • Obtaining Infor ION API file
            • Configure REST Connector with ION API file
          • IFS Cloud
            • IAM Client Registration
            • Obtaining end-point info from IFS Cloud
            • Configure REST Connector for IFS Cloud
      • Redirect URIs
    • Create and design
      • Application packages
      • Applications
        • Create
        • Design
        • Test
        • Commit
      • Portal Pages
        • Create Portal Page
        • Design Portal Page
        • Commit Portal Page
      • Components
        • Create component
        • Manage component
      • Modules
        • Create module
        • Manage module
      • Automations
        • Functionality
        • Create Automation
        • Manage Automation
        • Creating Access Key
        • Executing Automations Externally
          • IFS Cloud
          • Salesforce Apex Trigger Example
    • Deploy
      • Environments
      • Deploy
    • Use
      • On mobile devices
      • In web browser - Web client
      • In web browser - Portal
    • Share
      • Share Applications
    • User administration
      • Users
        • Invite a new user
        • Manage users
      • User groups
        • Create user groups
        • Manage user groups
      • Access
        • Manage access
  • ⏸️Reference
    • How-to guides
      • Create User Step controls
        • Header
        • Static text
        • Labelled static text
        • Link
        • Image viewer
        • Text input
        • Numeric input
        • Date input
        • Time input
        • Check box input
        • Binary option input
        • List selection input
        • List multi-selection input
        • Menu selection input
        • Data grid
        • Calendar control
        • Image selection input
        • List presentation
        • Camera Input
      • Dependent controls in User step
        • Variable source
        • Expression source
        • Control visibility (condition to hide)
      • Configure SSO for Microsoft Entra
    • Reference
      • Clients
        • Settings
        • My data
      • Designer
        • Controls
          • Header
          • Static text
          • Labeled static text
          • Link
          • External app launcher
          • Image viewer
          • Text input
          • Numeric input
          • Date input
          • Time input
          • Check box input
          • Binary option input
          • List selection input
          • List multi-selection input
          • Menu selection input
          • Data grid
          • Calendar
          • Image selection input
          • List presentation
          • Camera input
          • File gallery
          • GPS location input
          • Signature capture input
          • Item creation sub task
          • Check list sub task
          • Verb sub task
        • Steps
          • Start
          • User interaction
          • External system
          • Decision
          • Assertion
          • HTTP requests
          • Assignment
          • Table
          • Event listener
          • Checkpoint
          • Script
          • Annotation
          • End
          • Local data resource
      • Portal
        • Design items
          • Portlets
            • Accumulation chart
            • Base chart
            • Circular gauge
            • Custom content
            • Data tree
            • Document viewer
            • Filter
            • Kanban
            • KPI card
            • Link
            • My apps
            • Record
            • Rich text
            • Table
          • Container
          • Common portlet configuration
            • General
            • Events
            • Data
            • Custom buttons
            • Style
        • Portal settings
          • Branding
          • Page
          • Navigation
        • Profile
        • Portlet actions
        • Cache
        • Input to Start Step
      • Diagnostic mode
      • FlowScript
        • Walkthrough
          • Introduction
          • Expressions and programs
          • Anatomy of a program
          • Variables
          • Simple types
          • Nullable types
          • Records
          • Sequences
          • Other types
          • Arithmetic
          • Other expressions
          • Queries
          • Conditionals and loops
          • Function definitions
          • Built-in functions
          • DateTime module
          • Seq module
          • HTTP module
          • CSV module
          • JSON module
          • Trace module
          • Record module
          • XML Module
          • Custom modules
          • Custom Types
          • Appendix: Subtyping rules
          • Appendix: Escape sequences
          • Appendix: Type checking errors
      • Flowscript Copilot
      • Glossary
    • Flow Connect Downloads
      • Install Flow Connect Designer
    • Migrate from Flow Classic
      • Portal - migrate from Flow Classic
      • Classic vs. Connect Comparison Guide
Powered by GitBook
On this page
  • Advanced: Other types
  • unknown/any
  • nothing
  • Function types
  • Advanced: Type narrowing

Was this helpful?

  1. Reference
  2. Reference
  3. FlowScript
  4. Walkthrough

Other types

PreviousSequencesNextArithmetic

Last updated 1 year ago

Was this helpful?

Advanced: Other types

unknown/any

You can think of a type as a set of values. The type boolean is the set that contains true and false; the type number is the (much larger) set that contains 1, 2, 0.1845... and every other representable decimal number.

The type unknown represents the set of all possible values: every conceivable number, text, boolean, sequence, record, function, etc., is included. In other words, a variable of type unknown may contain either a number, a text, a sequence etc. Such an all-encompassing type is called a top type.

While there is not a lot you can do with an unknown value, you can use to refine it into a more useful type.

The type any also includes all possible values, but while an unknown value must be refined before it can be used, values of type any can be used in place of any other type without design-time errors. Values of type any are usually produced only after some other type checking error has already been emitted. You are strongly discouraged from ever declaring a variable of type any, since it will slip past the FlowScript type checking and enable all kinds of preventable errors.

nothing

The nothing type is the flip side of the unknown type: it is a type which contains no values at all. You cannot create a variable of type nothing, because there is no initial value you can put there.

You will usually encounter the nothing type only when creating empty sequences.

Function types

Functions in FlowScript are also values, and can be assigned to variables, included in records and so on. Because they are values, they also have types.

The name of a function type is constructed by listing all the arguments, followed by an arrow and the return type.

The following example creates a variable x and assigns it the built-in function.

// Example: create a variable of type (input: text) -> text.
let x = upper;
let result = x("test"); // 'result' has value "TEST"

Advanced: Type narrowing

A type narrowing expression consists of some value on the left, an is operator, and a type expression on the right.

// Example: create a function which returns a person's name,
// if it is there, or otherwise their ID.
function getName(person: { id: number }) {
    if person is { name: text }:
        return person.name;
    else:
        return person.id;
}

// getName({ name: "Lisa", id: 0 }) == "Lisa"
// getName({ id: 1 }) == 1

You can use the is operator, also known as the type narrowing operator, to check the type of a value. Like , the type narrowing operator refines the types of variables.

In the example above, the type of person is refined to contain the name member inside the if block. Note that the type is refined to the of the previous type and type expression on the right; in other words, the person variable keeps its id field even though the type narrowing expression specifies a type without it.

⏸️
greatest common subtype
null guards
type narrowing
upper