File: nodeModulesImportAssertions%28module%3Dnode16%29.types

package info (click to toggle)
node-typescript 5.0.4%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 459,116 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (36 lines) | stat: -rw-r--r-- 1,285 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
=== tests/cases/conformance/node/index.ts ===
import json from "./package.json" assert { type: "json" };
>json : { name: string; private: boolean; type: string; }
>type : any

=== tests/cases/conformance/node/otherc.cts ===
import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions
>json : { name: string; private: boolean; type: string; }
>type : any

const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine
>json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }>
>import("./package.json", { assert: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }>
>"./package.json" : "./package.json"
>{ assert: { type: "json" } } : { assert: { type: string; }; }
>assert : { type: string; }
>{ type: "json" } : { type: string; }
>type : string
>"json" : "json"

=== tests/cases/conformance/node/package.json ===
{
>{    "name": "pkg",    "private": true,    "type": "module"} : { name: string; private: boolean; type: string; }

    "name": "pkg",
>"name" : string
>"pkg" : "pkg"

    "private": true,
>"private" : boolean
>true : true

    "type": "module"
>"type" : string
>"module" : "module"
}