Giter Site home page Giter Site logo

opc-types's Introduction

OpenComputers and TypeScript

TypeScriptToLua TypeScriptToLua
Language
Build status Build status

Introduction

This repository contains type declarations for OpenOS and GUI (and also some of it dependencies).

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.

Installation

# 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
// 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:

    # linux / macos
    ln -s /path/to/disk/home/app dist
    # windows (cmd)
    mklink /j dist C:\path\to\disk\home
  • Use tstl --watch

opc-types's People

Contributors

exeteres avatar roobscoob avatar timoheijne avatar ymaril avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

opc-types's Issues

Issue building

When trying to build I get this error.

yarn run v1.22.10
$ tstl
node_modules/@opct/openos/component.d.ts:128:15 - error TS2694: Namespace 'OpenOS' has no exported member 'InventoryController'.

128     ): OpenOS.InventoryController | null;
                  ~~~~~~~~~~~~~~~~~~~

node_modules/@opct/openos/component.d.ts:161:72 - error TS2694: Namespace 'OpenOS' has no exported member 'InventoryController'.

161     function getPrimary(componentType: "inventory_controller"): OpenOS.InventoryController;
                                                                           ~~~~~~~~~~~~~~~~~~~

node_modules/@opct/openos/component.d.ts:269:40 - error TS2694: Namespace 'OpenOS' has no exported member 'InventoryController'.

269     const inventory_controller: OpenOS.InventoryController;
                                           ~~~~~~~~~~~~~~~~~~~

error Command failed with exit code 2.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.