Skip to main content Link Search Menu Expand Document (external link)

Primitive.ts overview

Since v1.0.0


Exports Grouped by Category


Predicates

isBool

Signature

declare const isBool: <A>(self: Primitive<A>) => boolean

Source

Since v1.0.0

combinators

getChoices

Returns a text representation of the valid choices for a primitive type, if any.

Signature

declare const getChoices: <A>(self: Primitive<A>) => Option<string>

Source

Since v1.0.0

getHelp

Returns help documentation for a primitive type.

Signature

declare const getHelp: <A>(self: Primitive<A>) => Span

Source

Since v1.0.0

getTypeName

Returns a string representation of the primitive type.

Signature

declare const getTypeName: <A>(self: Primitive<A>) => string

Source

Since v1.0.0

validate

Validates that the specified value, if any, matches the specified primitive type.

Signature

declare const validate: {
  (value: Option<string>, config: CliConfig): <A>(self: Primitive<A>) => Effect<A, string, FileSystem>
  <A>(self: Primitive<A>, value: Option<string>, config: CliConfig): Effect<A, string, FileSystem>
}

Source

Since v1.0.0

wizard

Runs a wizard that will prompt the user for input matching the specified primitive type.

Signature

declare const wizard: {
  (help: HelpDoc): <A>(self: Primitive<A>) => Prompt<A>
  <A>(self: Primitive<A>, help: HelpDoc): Prompt<A>
}

Source

Since v1.0.0

constructors

boolean

Represents a boolean value.

True values can be passed as one of: ["true", "1", "y", "yes" or "on"]. False value can be passed as one of: ["false", "o", "n", "no" or "off"].

Signature

declare const boolean: (defaultValue: Option<boolean>) => Primitive<boolean>

Source

Since v1.0.0

choice

Signature

declare const choice: <A>(alternatives: ReadonlyArray<[string, A]>) => Primitive<A>

Source

Since v1.0.0

date

Represents a date in ISO-8601 format, such as 2007-12-03T10:15:30.

Signature

declare const date: Primitive<Date>

Source

Since v1.0.0

float

Represents a floating point number.

Signature

declare const float: Primitive<number>

Source

Since v1.0.0

integer

Represents an integer.

Signature

declare const integer: Primitive<number>

Source

Since v1.0.0

text

Represents a user-defined piece of text.

Signature

declare const text: Primitive<string>

Source

Since v1.0.0

models

Primitive (interface)

A Primitive represents the primitive types supported by Effect CLI.

Each primitive type has a way to parse and validate from a string.

Signature

export interface Primitive<A> extends Primitive.Variance<A> {}

Source

Since v1.0.0

symbol

PrimitiveTypeId

Signature

declare const PrimitiveTypeId: unique symbol

Source

Since v1.0.0

PrimitiveTypeId (type alias)

Signature

type PrimitiveTypeId = typeof PrimitiveTypeId

Source

Since v1.0.0

utils

Primitive (namespace)

Source

Since v1.0.0

Variance (interface)

Signature

export interface Variance<A> extends Pipeable {
  readonly [PrimitiveTypeId]: {
    readonly _A: (_: never) => A
  }
}

Source

Since v1.0.0

PathExists (type alias)

Signature

type PathExists = "yes" | "no" | "either"

Source

Since v1.0.0

PathType (type alias)

Signature

type PathType = "file" | "directory" | "either"

Source

Since v1.0.0

ValueType (type alias)

Signature

type ValueType<P> = [P] extends [
  {
    readonly [PrimitiveTypeId]: {
      readonly _A: (_: never) => infer A
    }
  }
]
  ? A
  : never

Source

Since v1.0.0