-
Notifications
You must be signed in to change notification settings - Fork 136
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
79d3667
commit 465bda4
Showing
76 changed files
with
81 additions
and
8 deletions.
There are no files selected for viewing
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
4 changes: 2 additions & 2 deletions
4
src/082-cjs-vs-esm/210-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 |
---|---|---|
@@ -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(); |
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
src/082-cjs-vs-esm/210-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 |
---|---|---|
@@ -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(); |
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
src/082-cjs-vs-esm/210-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 |
---|---|---|
@@ -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(); |
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
src/082-cjs-vs-esm/211-import-syntax-for-cts.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" | ||
} |
7 changes: 7 additions & 0 deletions
7
src/082-cjs-vs-esm/211-import-syntax-for-cts.problem/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,7 @@ | ||
import otherModule from "./other-module.cjs"; | ||
|
||
const main = async () => { | ||
otherModule(); | ||
}; | ||
|
||
main(); |
5 changes: 5 additions & 0 deletions
5
src/082-cjs-vs-esm/211-import-syntax-for-cts.problem/src/other-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,5 @@ | ||
const hello = () => { | ||
console.log("Hello!"); | ||
}; | ||
|
||
export default hello; |
13 changes: 13 additions & 0 deletions
13
src/082-cjs-vs-esm/211-import-syntax-for-cts.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 | ||
}, | ||
} |
12 changes: 12 additions & 0 deletions
12
src/082-cjs-vs-esm/211-import-syntax-for-cts.solution/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" | ||
} |
7 changes: 7 additions & 0 deletions
7
src/082-cjs-vs-esm/211-import-syntax-for-cts.solution/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,7 @@ | ||
import otherModule = require("./other-module.cjs"); | ||
|
||
const main = async () => { | ||
otherModule(); | ||
}; | ||
|
||
main(); |
5 changes: 5 additions & 0 deletions
5
src/082-cjs-vs-esm/211-import-syntax-for-cts.solution/src/other-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,5 @@ | ||
const hello = () => { | ||
console.log("Hello!"); | ||
}; | ||
|
||
export = hello; |
13 changes: 13 additions & 0 deletions
13
src/082-cjs-vs-esm/211-import-syntax-for-cts.solution/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 | ||
}, | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.