GithubHelp home page GithubHelp logo

wartoshika / wow-declarations Goto Github PK

View Code? Open in Web Editor NEW
26.0 4.0 11.0 329 KB

Typescript declarations for the current live World of Warcraft Retail LUA API

License: MIT License

lua typescript-declaration wow-declarations wow typescript

wow-declarations's People

Contributors

aszecsei avatar jiawahawkodomo avatar martinjlowm avatar rob893 avatar wartoshika avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

wow-declarations's Issues

API Methods that return a tuple is not working

Hi,

I've wrote a a sample of the issue I found with methods that suppose to return a tuple in lua.

typescript source

export class App {
  constructor() {
    print("Hello World of Warcraft", "This is my Typescript addon!");
    
    const frame = CreateFrame("Frame", null, UIParent);
    frame.SetScript("OnUpdate", (frame, elapsed) => {

      let test = GetActionCooldown(1);
      print(`${test[0]}, ${test[1]}, ${test[2]}`);
    });
    frame.Show();
  }
}

lua result

function App.__init(self)
  print("Hello World of Warcraft", "This is my Typescript addon!")
  local frame = CreateFrame("Frame", nil, UIParent)
  frame:SetScript("OnUpdate", function (frame, elapsed)
    local test = GetActionCooldown(1)
    print("" .. tostring(test[(tonumber(0) + 1)]) .. ", " .. tostring(test[(tonumber(1) + 1)]) .. ", " .. tostring(test[(tonumber(2) + 1)]) .. "")
  end)
  frame:Show()
end

error
88a8260bb8891fc772f5f8ed9657eccb

Expected behaviour:
Lua Transpiler convert typescript tuple properly (I actually have no clue since you will need to give X different variable name from the typescript tuple (array)

Thanks

UPDATE:
I found the solution, I didn't know you could do this in typescript:

 let [start, duration, enable] = GetActionCooldown(1);
 print(`${start}, ${duration}, ${enable}`);

Nest interfaces under a WoWAPI namespace

I noticed all interfaces are prefixed with Wow<decl>, would you be interested in migrating to a WoWAPI namespace instead? It'll end up cleaner in my opinion. For reference, check out how I do it: https://github.com/martinjlowm/types-wow-api/blob/master/src/widgets/frame.d.ts

Your declaration collection seems more complete than mine, so I'm willing to help migrating existing types to this namespaced approach.

As a bonus it enables the use of WoWAPI.Object, which, within the namespace, can be referenced directly as Object, which will not interfere with JavaScript's declaration.

Rename to @types/wow-declarations on npm?

I am currently using these types with TypeScriptToLua, they are so so helpful, thanks!

Would you, or have you considered naming @types/wow-declarations? It would require no tsconfig.json update if this was rooted in @types/ because the default typeRoots includes anything with @types/**/*

Auto formatting settings?

Are you using Prettier etc?

Can you commit your settings.json or .prettierrc so that auto formatting settings are declared in the repo?

I am trying to create minimal diffs but every time I save it's reformatting..

Seems like you have this:

settings.json:

{
  "editor.tabSize": 4,
  "files.trimFinalNewlines": false,
  "files.trimTrailingWhitespace": false,
  "[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[typescriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  }
}

Types not defined.

Hello. I just started using this project and I'm trying to use some globals from the wow api but I get this:

screenshot

I did add the types to the compilerOptions.

What am I doing wrong?

Trouble with importing declarations.

There's quite a few functions/constants/etc that are not included in the WoWAPI namespace, and as a result they don't appear to be usable.

I have wow declarations defined in tsconfig:

    "typeRoots": [
      "node_modules/@wartoshika/wow-declarations/declarations",
      "node_modules/lua-types/5.1"
    ],

For example, CreateFrame (from ui.d.ts is not resolvable.

Full project is here: https://github.com/Brusalk/tsCoolDown

Please publish latest fix on npm as well

The fix for error TS2304: Cannot find name 'AtlasID'. is not pushed to npm despite the version being the same as the release in github.
(See 0e4b87d)

Please provide this fix to npm users as well, thank you.

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.