Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
  • Language Reference Guide
    • Readme
    • Types in the Nu Language
      • Basic Types
        • Any
        • Boolean
        • Integer
        • Float
        • Filesize
        • Duration
        • Datetime
        • Range
        • String
        • Record
        • List
        • Table
        • Closure
        • Nothing
        • Binary
        • Glob
        • Cell-Path
      • Other Data Types

        • Types used only in command signatures
          • Path
        • Types which are not declarable
          • Error
          • CustomValue
          • Block
      • Type signatures
      • Commands that interact with types
    • Operators
    • Flow control
      • if/else
      • loop
      • while
      • match
      • try/catch
      • break
      • return
      • continue
    • Filters
      • each and par-each
      • Filters to select subsets of data
      • where and filter
      • Understanding the difference between get and select
    • Custom Commands
    • Declarations
    • Variable Scope
    • Strings and Text Formatting
    • Helpers and debugging commands
    • Pipelines
    • MIME Types for Nushell

Commands that interact with types

The main type inspector in Nu is the describe command that takes any data type on input and reports its type signature.

E.g.

[foo bar baz] | describe
# => list<string>

Commands

  • describe

    • describe --detailed (-d) also shows the type of every nested value.
  • inspect

  • help

  • into (subcommands)

    • The into commands are used to cast one type into another.
    • into value converts a custom value (for example a semver or a matrix) into a regular Nushell value.
  • detect type

    • Infers a type from a string:

      "42" | detect type | describe
      # => int

      Durations written with units, including several units in a row, are detected too:

      "1hr 3min" | detect type | describe
      # => duration
  • ast

    • In the branches of abstract syntax tree that describe the type of some element
Edit this page on GitHub
Contributors: NotTheDr01ds, fdncred
Prev
Type signatures