TypeScript/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).js
Wesley Wigham de23842e45
Allow import assertions on esm imports under module: nodenext (#46630)
* Allow import assertions on esm imports under module: nodenext

* Changes to copy

Co-authored-by: Andrew Branch <andrew@wheream.io>
2021-11-02 15:34:37 -07:00

21 lines
683 B
TypeScript

//// [tests/cases/conformance/node/nodeModulesImportAssertions.ts] ////
//// [index.ts]
import json from "./package.json" assert { type: "json" };
//// [otherc.cts]
import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions
const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine
//// [package.json]
{
"name": "pkg",
"private": true,
"type": "module"
}
//// [index.js]
export {};
//// [otherc.cjs]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine