Skip to content

Commit 9ef7f79

Browse files
committed
feat: Upgrade ts config to target es2022 with node
1 parent 0a288cf commit 9ef7f79

2 files changed

Lines changed: 17 additions & 9 deletions

File tree

src/index.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,18 @@ async function main() {
144144
if (!fs.existsSync(OUTPUT_PATH))
145145
fs.mkdirSync(OUTPUT_PATH, { recursive: true })
146146

147-
const [{ content, name }] = files
148-
const fullPath = `${OUTPUT_PATH}/${name}`
147+
const [firstFile] = files
149148

150-
fs.writeFileSync(fullPath, content)
149+
if (firstFile) {
150+
const { name, content } = firstFile
151+
const fullPath = `${OUTPUT_PATH}/${name}`
151152

152-
if (optimizeTypes) {
153-
console.log('🤏 optimizing types')
154-
await optimizeTypesUtil(fullPath, typeWhitelist)
153+
fs.writeFileSync(fullPath, content)
154+
155+
if (optimizeTypes) {
156+
console.log('🤏 optimizing types')
157+
await optimizeTypesUtil(fullPath, typeWhitelist)
158+
}
155159
}
156160

157161
process.exit(0)

tsconfig.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
"strict": true,
44
"outDir": "dist",
55
"rootDir": "src",
6-
"module": "commonjs",
7-
"target": "es6",
6+
"target": "es2022",
7+
"module": "NodeNext",
8+
"moduleResolution": "NodeNext",
9+
"noUncheckedIndexedAccess": true,
10+
"isolatedModules": true,
811
"esModuleInterop": true,
912
"sourceMap": true,
1013
"declaration": true,
11-
"skipLibCheck": true
14+
"skipLibCheck": true,
15+
"allowJs": true
1216
},
1317
"exclude": ["node_modules", "templates"]
1418
}

0 commit comments

Comments
 (0)