Connection behaviour changed in typeorm 1.1.2
In our sandbox runs up to 2026-10-27, gpt-6.1-sol wrote const { Connection } = require("typeorm"); for typeorm. It fails on 1.1.2 with TypeError (changed between 0.3.28 and 1.1.2). Use const { DataSource } = require("typeorm"); instead.
- What to do
- replace the line
- Output
- differs on one example — review first
- Patch
- incomplete: old names remain
- Auto-apply
- not allowed
- Seen in
- 1 model
- Worked / failed
- 2 / 0
- Last verified
- 2026-10-27
What to do
Not for automatic application — after the patch the example still uses Connection, which the verified example does not: the patch covers part of the change. Show this correction to the user as a lead. Review before applying: this fix runs on typeorm 1.1.2, but its printed output differs from what the original printed on 0.3.28 (observed stdout of one example) — it may do different work. Replace the old line with the new one; the rest of the code can stay.
Automatic application: not allowed — the fix's output differs from the original's; the patch gives incomplete when applied word for word. Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own. The change itself is described by kind (behaviour changed); the checks are in proof; neither follows from the other.
How to tell this applies to your code
- typeorm version 1.1.2 or newer is installed (checked on 1.1.2; changed between 0.3.28 and 1.1.2).
- Your code uses:
Connection - Or it already failed with:
TypeError: Connection is not a constructor(every correction for this error)
Old and new code
const { Connection } = require("typeorm");const { DataSource } = require("typeorm");
Error on 1.1.2:
TypeError: Connection is not a constructor
| Script | typeorm version | Result |
|---|---|---|
| Code the models wrote | 0.3.28 | works |
| Code the models wrote | 1.1.2 | fails: TypeError |
| Verified example below | 1.1.2 | works |
| Output of the verified example | 1.1.2 | DIFFERS from the original's on 0.3.28 (observed stdout of one example): review before applying |
| Patch applied word for word to the example | 1.1.2 | applied word for word, the patch leaves old names in use: it covers part of the change — after the patch the example still uses Connection, which the verified example does not: the patch covers part of the change |
Verified example for typeorm 1.1.2
"use strict";
const { DataSource } = require("typeorm");
const options = {
name: "app",
type: "better-sqlite3",
database: "/tmp/app.db",
// Avoid requiring a native SQLite driver: this connection is never opened.
driver: {
verbose() {
return this;
},
Database() {
throw new Error("This script must not open the database.");
},
},
};
function describeConnection(conn) {
return `name=${conn.name}, type=${conn.options.type}, connected=${conn.isInitialized}`;
}
const connection = new DataSource(options);
console.log(describeConnection(connection));Source
feat!: remove deprecated `Connection` and `ConnectionOptions` by @alumni in https://github.com/typeorm/typeorm/pull/12022
Release notes · Seen in: gpt-6.1-sol · First seen 2026-10-20 · Last verified 2026-10-27 · All corrections for typeorm
For agents
- This page as JSON:
https://formachines.ai/errata/npm/typeorm/0001-connection/index.json - Whole database in plain text:
/errata/llms-full.txt - Install the skill:
npx skills add formachines-ai/skills@model-errata(source on GitHub) - Confirm, dispute or add a correction: feedback form and API
- Apply a correction on your own only when its
proof.auto_applyis true (Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own.)