An open API service indexing awesome lists of open source software.

https://github.com/exeteres/opc-types

OpenComputers and TypeScript
https://github.com/exeteres/opc-types

opencomputers openos typescript typings

Last synced: 29 days ago
JSON representation

OpenComputers and TypeScript

Awesome Lists containing this project

README

        

# OpenComputers and TypeScript


TypeScriptToLua
TypeScriptToLua

Language



Build status


Build status

## Introduction

This repository contains type declarations for [OpenOS](https://ocdoc.cil.li/) and [GUI](https://github.com/IgorTimofeev/GUI) (and also some of it dependencies).

It is assumed that you will use [TypeScriptToLua](https://github.com/TypeScriptToLua/TypeScriptToLua) as a transpiler.

Some examples can be found in the `examples` folder. Also look at [VSCode extension](https://github.com/Exeteres/oc-ts-extension), which integrates TypeScript with OpenComputers.

## Installation

```shell
# Typings for OpenOS
yarn add @opct/openos # or npm install @opct/openos -S

# Typings for MineOS
yarn add @opct/mineos

# Typings for GUI
yarn add @opct/gui

# TSTL
yarn add typescript-to-lua
```

```json
// tsconfig.json
{
"compilerOptions": {
"target": "esnext",
"outDir": "dist",
"module": "commonjs",
"lib": ["esnext"],
"strict": true,
"moduleResolution": "node",
"rootDir": "src",
"types": [
"lua-types/jit",
"@opct/openos",
"@opct/gui",
"@opct/mineos"
]
},
"tstl": {
"luaTarget": "JIT"
}
}
```

## Setting up a comfortable working environment

- 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.bufferChanges` to `false` in order to have external access to the disk.
- Create a link to the disk to keep the source code separate from it:

```shell
# linux / macos
ln -s /path/to/disk/home/app dist
```

```cmd
# windows (cmd)
mklink /j dist C:\path\to\disk\home
```

- Use `tstl --watch`