Skip to content

import-attributes ​

import data from "./data.json" assert { type: "json" }.

Why: import assertions were replaced by import attributes and removed from V8 and Node: the assert form now fails to load (v8.dev).

Rejected:

✕ Rejectedimport-attributes
ts
import config from "./config.json" assert { type: "json" };
export { default as defaults } from "./defaults.json" assert { type: "json" };

Accepted:

✓ Accepted0 diagnostics
ts
import config from "./config.json" with { type: "json" };

Quick fix: Use with.

The examples here are checked by safe-ts but not compiled with tsc: TypeScript itself no longer accepts the assert form, and ./config.json doesn't exist.

What the rule can't see: dynamic imports with the old option, import("./config.json", { assert: { type: "json" } }).

MIT OR Apache-2.0 · Docs by Gemini 4 Neon Extra