property
sqlite.Statement.declaredTypes
readonly declaredTypes: null | string[]
The declared column types from the table schema, as reported by sqlite3_column_decltype().
Returns an array of:
- The exact type string declared in the
CREATE TABLEstatement nullfor columns without declared types, such as expressions and computed columns
Available for both read-only and read-write statements, before and after they run.
// For table columns:
const stmt = db.prepare("SELECT id, name, weight FROM products");
console.log(stmt.declaredTypes);
// => ["INTEGER", "TEXT", "REAL"]
// For expressions (no declared types):
const exprStmt = db.prepare("SELECT length('bun') AS str_length");
console.log(exprStmt.declaredTypes);
// => [null]