Skip to content

hasType<N, T>(name, tag): TypeOfNode<{ name: N; type: T; }>

Defined in: src/query/expression.ts:472

The attribute is set with exactly this type, whatever its value.

Useful when the same name is written with different types across entities — a comparison already asserts the type, so this is for asking about the type alone.

N extends string

T extends IndexableTypeTag

N

T

The type tag: bool, i32, u64, u256, dec, str, addr or key — any type but bytes, which is never indexed.

TypeOfNode<{ name: N; type: T; }>

If the name is outside the attribute name grammar.

If the tag is not an indexable type, the name is a system attribute (whose type is fixed), or the name starts with $ but is not a system attribute.

hasType("age", "i32") // TYPEOF(age) = i32