This repository contains TypeScript declarations for OpenComputers APIs, some of its mods and operating systems, including OpenOS and MineOS.
It is assumed that you will use TypeScriptToLua as a transpiler.
Some examples can be found in the examples folder. Also look at VSCode extension, which integrates TypeScript with OpenComputers.
| Name | Type | Package |
|---|---|---|
| OpenComputers (common API) | Mod | @opct/common |
| Applied Energistics 2 integration | Mod | @opct/ae2 |
| OpenLight | Mod | @opct/openlight |
| OpenPrinter | Mod | @opct/openprinter |
| OpenSecurity | Mod | @opct/opensecurity |
| OpenOS | Operating system | @opct/openos |
| MineOS | Operating system | @opct/mineos |
# Typings for OpenOS
yarn add @opct/openos # or npm install @opct/openos -S
# Typings for MineOS
yarn add @opct/mineos
# TSTL
yarn add typescript-to-lua// tsconfig.json
{
"compilerOptions": {
"target": "esnext",
"outDir": "dist",
"module": "commonjs",
"lib": ["esnext"],
"strict": true,
"moduleResolution": "node",
"rootDir": "src",
"types": ["lua-types/jit", "@opct/openos", "@opct/mineos"]
},
"tstl": {
"luaTarget": "JIT"
}
}-
You can use Visual Studio Code or any other editor with TypeScript support.
-
Instead of a real mod, you can use an emulator. Otherwise, it is necessary to set
filesystem.bufferChangestofalsein order to have external access to the disk. -
Create a link to the disk to keep the source code separate from it:
# linux / macos ln -s /path/to/disk/home/app dist# windows (cmd) mklink /j dist C:\path\to\disk\home -
Use
tstl --watch

