File: verbatimModuleSyntaxRestrictionsCJS.js

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 (125 lines) | stat: -rw-r--r-- 3,669 bytes parent folder | download
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
//// [tests/cases/conformance/externalModules/verbatimModuleSyntaxRestrictionsCJS.ts] ////

//// [decl.d.ts]
declare function esmy(): void;
export default esmy;
export declare function funciton(): void;

//// [ambient.d.ts]
declare module "ambient" {
    const _default: number;
    export default _default;
}

//// [main.ts]
import esmy from "./decl"; // error
import * as esmy2 from "./decl"; // error
import { funciton } from "./decl"; // error
import type { funciton as funciton2 } from "./decl"; // ok I guess?
import("./decl"); // error
type T = typeof import("./decl"); // ok
export {}; // error
export const x = 1; // error
export interface I {} // ok
export type { T }; // ok
export namespace JustTypes {
    export type T = number;
}
export namespace Values { // error
    export const x = 1;
}
export default interface Default {} // sketchy, but ok

//// [main2.ts]
export interface I {}
export = { x: 1 };

//// [main3.ts]
namespace ns {
    export const x = 1;
    export interface I {}
}
export = ns;

//// [main4.ts]
export default 1; // error

//// [main5.ts]
export default class C {} // error

//// [main6.ts]
interface I {}
export default I; // error

//// [main7.ts]
import type esmy from "./decl";
export default esmy; // error


//// [main.js]
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Values = exports.x = void 0;
const decl_1 = __importDefault(require("./decl")); // error
const esmy2 = __importStar(require("./decl")); // error
const decl_2 = require("./decl"); // error
Promise.resolve().then(() => __importStar(require("./decl"))); // error
exports.x = 1; // error
var Values;
(function (Values) {
    Values.x = 1;
})(Values = exports.Values || (exports.Values = {}));
//// [main2.js]
"use strict";
module.exports = { x: 1 };
//// [main3.js]
"use strict";
var ns;
(function (ns) {
    ns.x = 1;
})(ns || (ns = {}));
module.exports = ns;
//// [main4.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = 1; // error
//// [main5.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class C {
} // error
exports.default = C;
//// [main6.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = I; // error
//// [main7.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = esmy; // error