forked from TypeScriptToLua/TypeScriptToLua.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1df93b7f.13b2c18d.js
More file actions
1 lines (1 loc) · 3.06 KB
/
Copy path1df93b7f.13b2c18d.js
File metadata and controls
1 lines (1 loc) · 3.06 KB
1
(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[237],{69562:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>f});var a=n(22122),i=n(36742),l=n(44996),r=n(11756),s=n(3066),c=n(67294);const o="title_1A8t",m="heroBanner_Nujh",u="quickNavButtons_8Xwo",d="quickNavButton_2Kn8",p="example_t7IC",y=[{title:"Extend existing APIs",description:c.createElement(c.Fragment,null,"This project is useful in any environment where Lua code is accepted, with the powerful option of simply declaring any existing API using TypeScript declaration files.")},{title:"Type Safety",description:c.createElement(c.Fragment,null,"Static types can ease the mental burden of writing programs, by automatically tracking information the programmer would otherwise have to track mentally in some fashion. Types serve as documentation for yourself and other programmers and provide a \u2018gradient\u2019 that tells you what terms make sense to write.")},{title:"IDE Support",description:c.createElement(c.Fragment,null,"Types enable Lua developers to use highly-productive development tools and practices like static checking and code refactoring when developing Lua applications. TypeScript extensions are available for many text editors.")}],h="\nfunction onAbilityCast(this: void, caster: Unit, targetPos: Vector) {\n const units = findUnitsInRadius(targetPos, 500);\n\n const enemies = units.filter(unit => caster.isEnemy(unit));\n\n for (const enemy of enemies) {\n enemy.kill();\n }\n\n}\n".trim(),E="\nfunction onAbilityCast(caster, targetPos)\n local units = findUnitsInRadius(targetPos, 500)\n local enemies = __TS__ArrayFilter(\n units,\n function(____, unit) return caster:isEnemy(unit) end\n )\n for ____, enemy in ipairs(enemies) do\n enemy:kill()\n end\nend\n".trim();function g({title:e,description:t}){return c.createElement("div",{className:"col col--4"},c.createElement("h3",null,e),c.createElement("p",null,t))}function f(){return c.createElement(s.Z,null,c.createElement("header",{className:`hero ${m} container`},c.createElement("h1",{className:`hero__title ${o}`},c.createElement("b",null,"Type"),c.createElement("wbr",null),"Script",c.createElement("wbr",null),"To",c.createElement("b",null,"Lua")),c.createElement("p",{className:"hero__subtitle"},"Write Lua with TypeScript"),c.createElement("div",{className:u},c.createElement(i.Z,{className:`button button--outline button--primary button--lg ${d}`,to:(0,l.Z)("docs/getting-started")},"Get Started"),c.createElement(i.Z,{className:`button button--outline button--success button--lg ${d}`,to:(0,l.Z)("play")},"Try Online"))),c.createElement("main",null,c.createElement("section",{className:"padding-vert--md container"},c.createElement("div",{className:"row"},c.createElement("div",{className:`col col--6 ${p}`},c.createElement(r.Z,{className:"typescript"},h)),c.createElement("div",{className:`col col--6 ${p}`},c.createElement(r.Z,{className:"lua"},E)))),c.createElement("section",{className:"padding-vert--lg container"},c.createElement("div",{className:"row"},y.map(((e,t)=>c.createElement(g,(0,a.Z)({key:t},e))))))))}}}]);