Skip to content

Utils.Function.is_identifier

DecentM edited this page Aug 27, 2024 · 57 revisions

@decentm/concourse-ts / Utils / is_identifier

Function: is_identifier()

is_identifier<IdentifierType>(input): input is IdentifierType

Returns if the input is a valid Identifier, using the compiler's validator.

https://concourse-ci.org/config-basics.html#schema.identifier

Example:

const name = 'my-name'
   // ^? string

new Job(name) // Compilation error

if (!is_identifier(name)) {
  return
}

new Job(name) // No error
     // ^? Identifier

get_identifier

Identifier

Type parameters

IdentifierType extends Identifier = Identifier

Parameters

input: unknown

The potential Identifier to check

Returns

input is IdentifierType

Type guard for valid identifiers, using branded types.

Source

utils/identifier/index.ts:43

Clone this wiki locally