Skip to content

Commit 7c40dca

Browse files
committed
chore: clarify requirements in tsconfig.json
Signed-off-by: Christian Stewart <christian@aperture.us>
1 parent 6a1190c commit 7c40dca

File tree

1 file changed

+36
-13
lines changed

1 file changed

+36
-13
lines changed

README.md

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,41 @@ npm install -g goscript
6464
goscript compile --package . --output ./dist
6565
```
6666

67+
## 📦 Using Generated Code in Your Project
68+
69+
After compiling your Go code to TypeScript, you'll need to set up your project to consume the generated files.
70+
71+
### TypeScript Configuration
72+
73+
Create or update your `tsconfig.json` with these settings:
74+
75+
```json
76+
{
77+
"compilerOptions": {
78+
"target": "ES2022",
79+
"module": "ESNext",
80+
"moduleResolution": "bundler",
81+
"lib": ["ES2022", "esnext.disposable", "dom"],
82+
"baseUrl": "./",
83+
"paths": {
84+
"@goscript/*": ["./path/to/generated/output/@goscript/*"]
85+
},
86+
"allowSyntheticDefaultImports": true,
87+
"esModuleInterop": true,
88+
"skipLibCheck": true,
89+
"strict": true
90+
}
91+
}
92+
```
93+
94+
**Important requirements:**
95+
- **`target: "ES2022"` or newer** - Required for `Disposable` and other features
96+
- **`lib: ["esnext.disposable"]`** - Enables TypeScript's disposable types for resource management
97+
- **`baseUrl` and `paths`** - Allows TypeScript to resolve `@goscript/*` imports
98+
- **`moduleResolution: "bundler"`** - Recommended for modern bundlers
99+
100+
You should be able to use any TypeScript bundler to compile the generated TypeScript.
101+
67102
## 💡 See It In Action
68103

69104
### Example: User Management
@@ -276,19 +311,7 @@ const searchUser = (email: string) => {
276311
- ⚡ Performance optimizations
277312
- 🔧 Better tooling integration
278313

279-
Check our [compliance tests](./compliance/COMPLIANCE.md) for detailed progress.
280-
281-
## 🤝 Real-World Use Cases
282-
283-
**Fintech:** Share complex financial calculations between Go services and trading dashboards
284-
285-
**Gaming:** Run the same game logic on servers and in browser clients
286-
287-
**Data Processing:** Use identical algorithms for backend ETL and frontend analytics
288-
289-
**Validation:** Keep business rules consistent across your entire stack
290-
291-
Ready to eliminate code duplication? [Get started now](#-get-started-in-2-minutes) 🚀
314+
Check the [compliance tests](./compliance/COMPLIANCE.md) for detailed progress.
292315

293316
## License
294317

0 commit comments

Comments
 (0)