Errata / npm / typescript
ts.ScriptTarget removed in typescript 7.0.2
In our sandbox runs up to 2026-10-27, claude-sonnet-5-5, gpt-6.1-sol and gemini-3.8-flash wrote target: ts.ScriptTarget.ES2020, for typescript. It fails on 7.0.2 with TypeError (changed between 6.0.2 and 7.0.2). There is no direct replacement in the new version.
- What to do
- no direct replacement
- Output
- same on one example
- Patch
- nothing to apply word for word
- Auto-apply
- not allowed
- Seen in
- 3 models
- Worked / failed
- 22 / 0
- Last verified
- 2026-10-27
What to do
Not for automatic application — format removed: there is no replacement to apply. Show this correction to the user as a lead. ts.ScriptTarget is not available in typescript 7.0.2; remove or replace this use. The same code works on typescript 6.0.2: pin a version before 7.0.2 if you cannot change the code.
Automatic application: not allowed — the patch gives not_applicable 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 (removed); the checks are in proof; neither follows from the other.
How to tell this applies to your code
- typescript version 7.0.2 or newer is installed (checked on 7.0.2; changed between 6.0.2 and 7.0.2).
- Your code uses:
ts.ScriptTarget.ES2020 - Or it already failed with:
TypeError: Cannot read properties of undefined (reading 'ES2020')(every correction for this error)
Old code
target: ts.ScriptTarget.ES2020,No direct replacement: the verified example below shows code that works without it.
Error on 7.0.2:
TypeError: Cannot read properties of undefined (reading 'ES2020')
Other verified fixes
The fix above passed 16 times. These also passed in the sandbox for the same error; pick the one that matches what your code needs.
Replace the line · passed 3 times · claude-sonnet-5-5, gpt-6.1-sol, gemini-3.8-flash · patch: fails when applied word for word
target: ts.ScriptTarget.ES2020,target: "ES2020",Not for automatic application — the patched example does not run on 7.0.2: exit code 1, TypeError: Cannot read properties of undefined (reading 'CommonJS'). Show this correction to the user as a lead. Replace the old line with the new one; the rest of the code can stay.
Rewrite the block · passed 2 times · gpt-6.1-sol · patch: fails when applied word for word
const result = ts.transpileModule(source, {
compilerOptions: {
target: ts.ScriptTarget.ES5,
module: ts.ModuleKind.CommonJS,
newLine: ts.NewLineKind.LineFeed
},
fileName: 'example.ts'
});const result = {
outputText: stripTypeScriptTypes(source, {
mode: 'transform',
sourceUrl: 'example.ts'
})
};Not for automatic application — the patched example does not run on 7.0.2: exit code 1, ReferenceError: stripTypeScriptTypes is not defined. Show this correction to the user as a lead. Review before applying: this fix runs on typescript 7.0.2, but its printed output differs from what the original printed on 6.0.2 (observed stdout of one example) — it may do different work. Rewrite the block as shown; the failing call does not appear in the new version of the block.
Rewrite the block · passed 1 time · gpt-6.1-sol · patch: fails when applied word for word
const result = ts.transpileModule(source, {
compilerOptions: {
target: ts.ScriptTarget.ES5,
module: ts.ModuleKind.CommonJS
}
});const result = {
outputText: stripTypeScriptTypes(source, { mode: "transform" })
};Not for automatic application — the patched example does not run on 7.0.2: exit code 1, ReferenceError: stripTypeScriptTypes is not defined. Show this correction to the user as a lead. Review before applying: this fix runs on typescript 7.0.2, but its printed output differs from what the original printed on 6.0.2 (observed stdout of one example) — it may do different work. Rewrite the block as shown; the failing call does not appear in the new version of the block.
Alternatives are leads for the user, not for automatic application: 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.
| Script | typescript version | Result |
|---|---|---|
| Code the models wrote | 6.0.2 | works |
| Code the models wrote | 7.0.2 | fails: TypeError |
| Verified example below | 7.0.2 | works |
| Output of the verified example | 7.0.2 | same as the original's on 6.0.2 (observed stdout of one example; not a proof of equivalent behaviour) |
| Patch applied word for word to the example | 7.0.2 | no literal patch to apply (removed or added code, or the old line is not found once) — format removed: there is no replacement to apply |
Verified example for typescript 7.0.2
const fs = require("node:fs");
const path = require("node:path");
const ts = require("typescript");
const projectDir = "/tmp/alias-demo";
const srcDir = path.join(projectDir, "src");
const indexFile = path.join(srcDir, "index.ts");
fs.mkdirSync(path.join(srcDir, "utils"), { recursive: true });
fs.writeFileSync(
path.join(srcDir, "utils", "math.ts"),
"export const add = (a: number, b: number): number => a + b;\n"
);
fs.writeFileSync(
indexFile,
'import { add } from "@/utils/math";\nconsole.log(add(2, 3));\n'
);
const compilerOptions = {
paths: {
"@/*": ["./src/*"],
},
};
function resolveModuleName(moduleName, containingFile, options) {
const extensions = [".ts", ".tsx", ".d.ts"];
const tryFile = (candidate) => {
for (const ext of extensions) {
const file = candidate + ext;
if (fs.existsSync(file) && fs.statSync(file).isFile()) return file;
}
for (const ext of extensions) {
const file = path.join(candidate, "index" + ext);
if (fs.existsSync(file) && fs.statSync(file).isFile()) return file;
}
return undefined;
};
for (const [pattern, targets] of Object.entries(options.paths || {})) {
const star = pattern.indexOf("*");
let matched;
if (star === -1) {
if (pattern === moduleName) matched = "";
} else {
const prefix = pattern.slice(0, star);
const suffix = pattern.slice(star + 1);
if (
moduleName.startsWith(prefix) &&
moduleName.endsWith(suffix) &&
moduleName.length >= prefix.length + suffix.length
) {
matched = moduleName.slice(prefix.length, moduleName.length - suffix.length);
}
}
if (matched === undefined) continue;
for (const target of targets) {
const candidate = path.resolve(projectDir, target.replace("*", matched));
const resolvedFileName = tryFile(candidate);
if (resolvedFileName) return { resolvedModule: { resolvedFileName } };
}
}
return { resolvedModule: undefined };
}
const { resolvedModule } = resolveModuleName(
"@/utils/math",
indexFile,
compilerOptions
);
if (!resolvedModule) {
throw new Error("Could not resolve @/utils/math");
}
console.log(path.resolve(resolvedModule.resolvedFileName));Source
No release-note sentence matched this change; the evidence is the sandbox check above.
Seen in: claude-sonnet-5-5, gpt-6.1-sol, gemini-3.8-flash · First seen 2026-10-20 · Last verified 2026-10-27 · All corrections for typescript
For agents
- This page as JSON:
https://formachines.ai/errata/npm/typescript/0001-baseurl/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.)