I created a mini project testing top-level await and VSCode is complaining about it, even though the tsup configuration is working and compiling the file, is there a way to generate a tsconfig from tsup for VSCode to see?
index.ts
export const delay = (ms: number) =>
new Promise(resolve => setTimeout(resolve, ms))
console.log('Hello')
await delay(1000)
console.log('There')
tsup.config.ts
import { defineConfig } from 'tsup'
export default defineConfig({
entry: ['src/index.ts'],
watch: true,
target: 'node16',
format: 'esm',
onSuccess: 'node dist/index.mjs',
})
Error VS Code
Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher.ts(1378)
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too