This repository contains TypeScript type definitions for DCS Worlds GUI Environment, enabling developers to use TypeScript’s powerful type system when scripting for DCS World. These type definitions are designed to be used with TypeScriptToLua to transpile TypeScript code into Lua, which is the scripting language used by DCS World.
To use these type definitions in your project, you need to have Node.js and npm installed. You can then install the type definitions via npm with the command
npm install @flying-dice/tslua-dcs-gui-types
TBC
Contributions to this project are welcome. If you find an issue or have suggestions for improvements, please open an issue or submit a pull request.
Exports use the project's GUI bridge (tslua-dcs-bridge). Follow the canonical update guide: run npm run dcs:start, then npm run export.
To refresh generated interface data, run
npm run export
This will
scripts/export.bridge.luaFrom here you can extend the underlying interface and replace the typing information.
Updating the packages/tslua-dcs-gui-types/src/index.d.ts with a variable where the type is of your extending interface will allow it to be used.
To add namespaces, update scripts/config.ts and run npm run export again.
Everything runs offline on the repository's lua51 interpreter with @flying-dice/tslua-luatest:
npm test --workspace=@flying-dice/tslua-dcs-gui-types # declarations, doubles and export generator
npm test --workspace=@flying-dice/tslua-dcs-gui-types-test # the executable examples, offline
npm run test:dcs:gui # the same examples inside DCS (project bridge)
tests/doubles/ holds the DCS GUI test doubles (DCS, Export, net, lfs, log, terrain,
coalition, db), typed against these declarations and preloaded with lua51 --preload. See
tests/doubles/README.md for what they model and how to extend them.tests/call-shapes.ts calls every declared function once through a spy, checking that it compiles
to a dot call with the declared arguments. tests/lua-shapes.ts covers multiple return values,
callbacks DCS invokes (DCS.setUserCallbacks), iterators, overloads and object methods.tests/surface.ts checks that the doubles expose exactly the members of src/exports/*.export.ts.npm run test:export type-checks scripts/ and tests scripts/export.bridge.lua against fixtures.This project is licensed under the MIT License.
For any inquiries or contributions, please open an issue on this repository.