Typescript
For Typescript in RCC, roblox-ts
is used internally. All valid roblox-ts
code is valid for RCC.
Use roblox-ts
's Documentation for more information on Typescript.
Importing Python in Typescript
To import Python in Typescript, lets imagine 2 files:
# myPythonFile.py
global printHi
def printHi(name):
print(f"Greetings, {name}")
return True
and
// myTypescriptFile.ts
import myPythonFile from "./myPythonFile"
myPythonFile.printHi("John Lua")
This will not work out of the box. In order to import Python in Typescript you need to make a d.ts
file.
// myPythonFile.d.ts
interface myPythonFile {
printHi(input: string): boolean;
}
declare const myPythonFile: myPythonFile;
export = myPythonFile;