JavaScript

How to use Import Assertions?

Medium
2
Added
Type hints for module imports (ES2022). Ensures correct MIME type handling.

Solution Code

JavaScript
import data from './data.json' assert { type: 'json' };
Explanation
Prevents unexpected execution of non-JS resources. Supported for JSON modules.

Guided Hints

Dynamic imports
Security implications