egoist / egoist/tsup

Generate a tsconfig.json for VSCode to use

Open
#674 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

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
```typescript
export const delay = (ms: number) =>
new Promise(resolve => setTimeout(resolve, ms))

console.log('Hello')

await delay(1000)

console.log('There')
```

tsup.config.ts
```typescript
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
```bash
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)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.