Skip to content

Commit

Permalink
2023-09-18T12:02:51.396Z
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpocock committed Sep 18, 2023
1 parent 79d3667 commit 465bda4
Show file tree
Hide file tree
Showing 76 changed files with 81 additions and 8 deletions.
3 changes: 1 addition & 2 deletions plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ Import/export type
`__dirname` not usable in ESM

incremental
composite
lib: dom, lib: es2022

useDefineForClassFields (https://twitter.com/heyImMapleLeaf/status/1701623837756993900)

Use suggestions here: https://twitter.com/mattpocockuk/status/1701619240686485799

noUnusedLocals/Parameters
include/exclude/paths
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @ts-expect-error
import esModule from "./esm-module.js";
import otherModule from "./other-module.js";

const main = async () => {
esModule();
otherModule();
};

main();
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @ts-expect-error
import esModule from "./esm-module.js";
import otherModule from "./other-module.js";

const main = async () => {
esModule();
otherModule();
};

main();
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @ts-expect-error
import esModule from "./esm-module.js";
import otherModule from "./other-module.cjs";

const main = async () => {
esModule();
otherModule();
};

main();
12 changes: 12 additions & 0 deletions src/082-cjs-vs-esm/211-import-syntax-for-cts.problem/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "117-const-enums.explainer",
"version": "1.0.0",
"description": "",
"scripts": {
"dev": "nodemon --exec \"tsc && node dist/index.mjs\" ./src/index.mts"
},
"keywords": [],
"author": "Matt Pocock",
"devDependencies": {},
"type": "module"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import otherModule from "./other-module.cjs";

const main = async () => {
otherModule();
};

main();
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const hello = () => {
console.log("Hello!");
};

export default hello;
13 changes: 13 additions & 0 deletions src/082-cjs-vs-esm/211-import-syntax-for-cts.problem/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "dist",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"isolatedModules": true,
"verbatimModuleSyntax": true
},
}
12 changes: 12 additions & 0 deletions src/082-cjs-vs-esm/211-import-syntax-for-cts.solution/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "117-const-enums.explainer",
"version": "1.0.0",
"description": "",
"scripts": {
"dev": "nodemon --exec \"tsc && node dist/index.mjs\" ./src/index.mts"
},
"keywords": [],
"author": "Matt Pocock",
"devDependencies": {},
"type": "module"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import otherModule = require("./other-module.cjs");

const main = async () => {
otherModule();
};

main();
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const hello = () => {
console.log("Hello!");
};

export = hello;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "dist",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"isolatedModules": true,
"verbatimModuleSyntax": true
},
}

0 comments on commit 465bda4

Please sign in to comment.