Type.NonNullable
TypeReturns the non-nullable version of a type, stripping the nullable wrapper if present.
Syntax
Type.NonNullable(type as type) as typeParameters
| Name | Type | Required | Description |
|---|---|---|---|
type | type | Yes | The type to unwrap. If it is already non-nullable, it is returned as-is. |
Return Value
type — The non-nullable form of the given type.
Remarks
Type.NonNullable strips the nullable wrapper from a type, returning the underlying non-nullable type. If the input is type nullable X, the result is type X. If the input is already non-nullable, it is returned unchanged — the function is idempotent on non-nullable types.
Making a type nullable goes in the other direction using the nullable keyword in a type expression (e.g., type nullable number). There is no dedicated Type.Nullable function — Type.NonNullable is a one-way stripping operation.
Common use cases for Type.NonNullable include:
- Type normalization: comparing two types for equivalence after stripping nullable wrappers, since type number and type nullable number are distinct values
- Generic transforms: building functions that work on the base type regardless of whether the input type is nullable
- Schema inspection: reducing column types from data sources (which often return nullable types) to their base kind for comparison
Use Type.IsNullable to check whether stripping is needed before calling Type.NonNullable, if you want to avoid unnecessary calls.
Examples
Example 1: Strip nullable wrapper from nullable number
Type.NonNullable(type nullable number)Result | |
|---|---|
| 1 | type number |
Example 3: Verify NonNullable of nullable equals the base type
Type.NonNullable(type nullable number) = type numberResult | |
|---|---|
| 1 | TRUE |