or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

constants.mddata-proxy.mderror-handling.mdexpression-system.mdextension-system.mdgraph-utilities.mdindex.mdnode-execution.mdspecialized-modules.mdtype-guards.mdtype-validation.mdutilities.mdworkflow-management.md

type-guards.mddocs/

0

# Type Guards

1

2

Runtime type checking functions that validate if values match specific n8n interface types, providing type safety for dynamic workflow data.

3

4

## Capabilities

5

6

### Node Property Type Guards

7

8

Type guard functions for validating node property configurations and structures.

9

10

```typescript { .api }

11

/**

12

* Checks if a value is a valid INodeProperties interface

13

* @param value - Value to check

14

* @returns true if value matches INodeProperties structure

15

*/

16

function isINodeProperties(value: any): value is INodeProperties;

17

18

/**

19

* Checks if a value is a valid INodePropertyOptions interface

20

* @param value - Value to check

21

* @returns true if value matches INodePropertyOptions structure

22

*/

23

function isINodePropertyOptions(value: any): value is INodePropertyOptions;

24

25

/**

26

* Checks if a value is a valid INodePropertyCollection interface

27

* @param value - Value to check

28

* @returns true if value matches INodePropertyCollection structure

29

*/

30

function isINodePropertyCollection(value: any): value is INodePropertyCollection;

31

32

/**

33

* Checks if a value is a valid list of INodeProperties

34

* @param value - Value to check

35

* @returns true if value is an array of INodeProperties

36

*/

37

function isINodePropertiesList(value: any): value is INodeProperties[];

38

39

/**

40

* Checks if a value is a valid list of INodePropertyCollection

41

* @param value - Value to check

42

* @returns true if value is an array of INodePropertyCollection

43

*/

44

function isINodePropertyCollectionList(value: any): value is INodePropertyCollection[];

45

46

/**

47

* Checks if a value is a valid list of INodePropertyOptions

48

* @param value - Value to check

49

* @returns true if value is an array of INodePropertyOptions

50

*/

51

function isINodePropertyOptionsList(value: any): value is INodePropertyOptions[];

52

```

53

54

### Resource and Value Type Guards

55

56

Type guard functions for validating resource mapper values, locator values, and filter configurations.

57

58

```typescript { .api }

59

/**

60

* Checks if a value is a valid resource mapper value

61

* @param value - Value to check

62

* @returns true if value matches IResourceMapperValue structure

63

*/

64

function isResourceMapperValue(value: any): value is IResourceMapperValue;

65

66

/**

67

* Checks if a value is a valid resource locator value

68

* @param value - Value to check

69

* @returns true if value matches IResourceLocatorValue structure

70

*/

71

function isResourceLocatorValue(value: any): value is IResourceLocatorValue;

72

73

/**

74

* Checks if a value is a valid filter value configuration

75

* @param value - Value to check

76

* @returns true if value matches IFilterValue structure

77

*/

78

function isFilterValue(value: any): value is IFilterValue;

79

```

80

81

## Types

82

83

The type guard functions validate against these core interfaces:

84

85

```typescript { .api }

86

interface INodeProperties {

87

displayName: string;

88

name: string;

89

type: NodePropertyTypes;

90

default?: NodeParameterValueType;

91

description?: string;

92

options?: INodePropertyOptions[];

93

placeholder?: string;

94

required?: boolean;

95

displayOptions?: IDisplayOptions;

96

routing?: INodePropertyRouting;

97

credentialTypes?: INodePropertyCredentialType[];

98

// Additional properties...

99

}

100

101

interface INodePropertyOptions {

102

name: string;

103

value: string | number | boolean;

104

description?: string;

105

action?: string;

106

routing?: INodePropertyRouting;

107

}

108

109

interface INodePropertyCollection {

110

displayName: string;

111

name: string;

112

values: INodeProperties[];

113

default?: IDataObject;

114

description?: string;

115

displayOptions?: IDisplayOptions;

116

options?: INodePropertyCollectionOption[];

117

}

118

119

interface IResourceMapperValue {

120

mappingMode: string;

121

value: object | null;

122

matchingColumns: string[];

123

schema: ResourceMapperField[];

124

}

125

126

interface IResourceLocatorValue {

127

mode: string;

128

value: NodeParameterValueType;

129

cachedResultName?: string;

130

cachedResultUrl?: string;

131

__rl: true;

132

}

133

134

interface IFilterValue {

135

conditions: FilterConditionValue;

136

combinator: FilterCombinator;

137

// Additional filter properties...

138

}

139

```