Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,14 @@ Label.Align.ALIGN_LEFT | godot.Label.Align.ALIGN_LEFT
}
```

### TypeScript support
### TypeScript support and JSX code completion
- Run the menu command `Project > Tools > ECMAScript > Generate TypeScript Project` from the godot editor to generate a TypeScript project
- Run `tsc -w -p .` under your project folder in the terminal to compile scripts

#### Code completion
- Code completion in TSX will automatically work once the TypeScript project is generated by the above steps.
- Code completion in JSX in VS Code is achieved by the property `"types": "./godot.d.ts"` in the generated package.json file of the TypeScript project. The `godot.d.ts` file can be generated alone via the `Project > Tools > ECMAScript > Generate TypeScript Declaration File` editor menu option and added to a `package.json` file manually to achieve this without a full TypeScript project.

#### Example TypeScript Usage

Make sure the file with extension '.tsx' so it can be compiled to a `.jsx` file then we can attach it to a node in godot editor.
Expand Down
3 changes: 2 additions & 1 deletion misc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
},
"devDependencies": {
"typescript": "^3.9.7"
}
},
"types": "godot.d.ts"
}