-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8fa06a
commit b1c67f6
Showing
12 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
src/082-cjs-vs-esm/209.5-treat-ts-files-as-cjs.problem/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
6 changes: 6 additions & 0 deletions
6
src/082-cjs-vs-esm/209.5-treat-ts-files-as-cjs.problem/src/esm-module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const hello = () => { | ||
console.log("Hello!"); | ||
}; | ||
|
||
// @ts-expect-error | ||
export default hello; |
8 changes: 8 additions & 0 deletions
8
src/082-cjs-vs-esm/209.5-treat-ts-files-as-cjs.problem/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// @ts-expect-error | ||
import esModule from "./esm-module.js"; | ||
|
||
const main = async () => { | ||
esModule(); | ||
}; | ||
|
||
main(); |
13 changes: 13 additions & 0 deletions
13
src/082-cjs-vs-esm/209.5-treat-ts-files-as-cjs.problem/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}, | ||
} |
11 changes: 11 additions & 0 deletions
11
src/082-cjs-vs-esm/209.5-treat-ts-files-as-cjs.solution.1/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"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": {} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/082-cjs-vs-esm/209.5-treat-ts-files-as-cjs.solution.1/src/esm-module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const hello = () => { | ||
console.log("Hello!"); | ||
}; | ||
|
||
// @ts-expect-error | ||
export default hello; |
8 changes: 8 additions & 0 deletions
8
src/082-cjs-vs-esm/209.5-treat-ts-files-as-cjs.solution.1/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// @ts-expect-error | ||
import esModule from "./esm-module.js"; | ||
|
||
const main = async () => { | ||
esModule(); | ||
}; | ||
|
||
main(); |
13 changes: 13 additions & 0 deletions
13
src/082-cjs-vs-esm/209.5-treat-ts-files-as-cjs.solution.1/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
12
src/082-cjs-vs-esm/209.5-treat-ts-files-as-cjs.solution.2/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
6 changes: 6 additions & 0 deletions
6
src/082-cjs-vs-esm/209.5-treat-ts-files-as-cjs.solution.2/src/esm-module.cts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const hello = () => { | ||
console.log("Hello!"); | ||
}; | ||
|
||
// @ts-expect-error | ||
export default hello; |
8 changes: 8 additions & 0 deletions
8
src/082-cjs-vs-esm/209.5-treat-ts-files-as-cjs.solution.2/src/index.cts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// @ts-expect-error | ||
import esModule from "./esm-module.js"; | ||
|
||
const main = async () => { | ||
esModule(); | ||
}; | ||
|
||
main(); |
13 changes: 13 additions & 0 deletions
13
src/082-cjs-vs-esm/209.5-treat-ts-files-as-cjs.solution.2/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}, | ||
} |