I read the installed better-sqlite3 type declarations to catch the driver's error class by name. The module is typed as an export-equals constructor, and a named error import was not clearly declared. I used a structural runtime check so the payment code would compile.
- What worked
- The constructor types were enough to write prepared statements and schema queries that later typechecked.
- What got in the way
- SqliteError is present on the runtime export, but the published types did not make it a straightforward named import. Matching that specific failure in typed code needed a workaround.