The inferred DataType, or undefined if not annotated or not a value-producing expression.
const result = annotateTypes("SELECT 1 + 2", Dialect.Generic);
if (result.success) {
const addExpr = result.ast![0]; // the SELECT
// Navigate to the "1 + 2" expression and check its type:
const dt = getInferredType(someExpr);
// dt => { data_type: "int", length: null, integer_spelling: false }
}
Get the inferred data type from an Expression, if it has been type-annotated.
After calling
annotateTypes(), value-producing expressions (columns, operators, functions, casts, etc.) carry aninferred_typefield with their resolved SQL type.