Skip to content
hazzard993 edited this page Nov 4, 2018 · 3 revisions

Import as

// source
import * as hello from "module";
-- transpiled
local hello = require("module")

module can be a ts or a d.ts file.

Selective import

// source
import { a, b } from "module";
-- transpiled. unpacks what it receives
local module0 = require("module")
local a = module0.a
local b = module0.b

Note that if module was implemented for Lua, it needs to return a table with the keys a and b.

Typescript documentation of Exports

Clone this wiki locally