Dagger NodeJS SDK
api/client.gen.TypeDef
A definition of a parameter or return type in a Module.
Hierarchy
-
BaseClient↳
TypeDef
Constructors
constructor
new TypeDef(parent?, _id?, _kind?, _optional?): TypeDef
Constructor is used for internal usage only, do not create object from it.
Parameters
| Name | Type |
|---|---|
parent? | Object |
parent.ctx | Context |
parent.queryTree? | QueryTree[] |
_id? | TypeDefID |
_kind? | TypeDefKind |
_optional? | boolean |
Returns
Overrides
BaseClient.constructor
Properties
_id
Private Optional Readonly _id: TypeDefID = undefined
_kind
Private Optional Readonly _kind: TypeDefKind = undefined
_optional
Private Optional Readonly _optional: boolean = undefined
Methods
asInput
asInput(): InputTypeDef
If kind is INPUT, the input-specific type definition. If kind is not INPUT, this will be null.
Returns
asInterface
asInterface(): InterfaceTypeDef
If kind is INTERFACE, the interface-specific type definition. If kind is not INTERFACE, this will be null.
Returns
asList
asList(): ListTypeDef
If kind is LIST, the list-specific type definition. If kind is not LIST, this will be null.
Returns
asObject
asObject(): ObjectTypeDef
If kind is OBJECT, the object-specific type definition. If kind is not OBJECT, this will be null.
Returns
id
id(): Promise<TypeDefID>
A unique identifier for this TypeDef.
Returns
Promise<TypeDefID>
kind
kind(): Promise<TypeDefKind>
The kind of type this is (e.g. primitive, list, object).
Returns
Promise<TypeDefKind>
optional
optional(): Promise<boolean>
Whether this type can be set to null. Defaults to false.
Returns
Promise<boolean>
with
with(arg): TypeDef
Call the provided function with current TypeDef.
This is useful for reusability and readability by not breaking the calling chain.
Parameters
| Name | Type |
|---|---|
arg | (param: TypeDef) => TypeDef |
Returns
withConstructor
withConstructor(function_): TypeDef
Adds a function for constructing a new instance of an Object TypeDef, failing if the type is not an object.
Parameters
| Name | Type |
|---|---|
function_ | Function_ |
Returns
withField
withField(name, typeDef, opts?): TypeDef
Adds a static field for an Object TypeDef, failing if the type is not an object.
Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the field in the object |
typeDef | TypeDef | The type of the field |
opts? | TypeDefWithFieldOpts | - |
Returns
withFunction
withFunction(function_): TypeDef
Adds a function for an Object or Interface TypeDef, failing if the type is not one of those kinds.
Parameters
| Name | Type |
|---|---|
function_ | Function_ |
Returns
withInterface
withInterface(name, opts?): TypeDef
Returns a TypeDef of kind Interface with the provided name.
Parameters
| Name | Type |
|---|---|
name | string |
opts? | TypeDefWithInterfaceOpts |
Returns
withKind
withKind(kind): TypeDef
Sets the kind of the type.
Parameters
| Name | Type |
|---|---|
kind | TypeDefKind |
Returns
withListOf
withListOf(elementType): TypeDef
Returns a TypeDef of kind List with the provided type for its elements.
Parameters
| Name | Type |
|---|---|
elementType | TypeDef |
Returns
withObject
withObject(name, opts?): TypeDef
Returns a TypeDef of kind Object with the provided name.
Note that an object's fields and functions may be omitted if the intent is only to refer to an object. This is how functions are able to return their own object, or any other circular reference.
Parameters
| Name | Type |
|---|---|
name | string |
opts? | TypeDefWithObjectOpts |
Returns
withOptional
withOptional(optional): TypeDef
Sets whether this type can be set to null.
Parameters
| Name | Type |
|---|---|
optional | boolean |