Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] It definitely works, even with eluna-ts.

[DiscordArchive] It definitely works, even with eluna-ts.

[DiscordArchive] It definitely works, even with eluna-ts.

rektbyfaith
Administrator
0
07-05-2024, 08:43 PM
#1
Archived author: Honey • Posted: 2024-07-05T20:43:37.283000+00:00
Original source

It definitely works, even with eluna-ts.
Maybe you're using an environment that's not aware of it?
rektbyfaith
07-05-2024, 08:43 PM #1

Archived author: Honey • Posted: 2024-07-05T20:43:37.283000+00:00
Original source

It definitely works, even with eluna-ts.
Maybe you're using an environment that's not aware of it?

rektbyfaith
Administrator
0
07-05-2024, 08:49 PM
#2
Archived author: johnford2002 • Posted: 2024-07-05T20:49:28.233000+00:00
Original source

Certainly possible, I've had issues with VS Code recognizing the types with the default configuration contained in the `acore-docker` project.
rektbyfaith
07-05-2024, 08:49 PM #2

Archived author: johnford2002 • Posted: 2024-07-05T20:49:28.233000+00:00
Original source

Certainly possible, I've had issues with VS Code recognizing the types with the default configuration contained in the `acore-docker` project.

rektbyfaith
Administrator
0
07-05-2024, 09:02 PM
#3
Archived author: johnford2002 • Posted: 2024-07-05T21:02:35.083000+00:00
Original source

K, so it definitely works if I write it into the outputted eluna-ts.lua file, so it IS present. It must have something to do with the TS config.
rektbyfaith
07-05-2024, 09:02 PM #3

Archived author: johnford2002 • Posted: 2024-07-05T21:02:35.083000+00:00
Original source

K, so it definitely works if I write it into the outputted eluna-ts.lua file, so it IS present. It must have something to do with the TS config.

rektbyfaith
Administrator
0
07-05-2024, 09:18 PM
#4
Archived author: johnford2002 • Posted: 2024-07-05T21:18:05.711000+00:00
Original source

Any idea what types would be missing? I don't see any references to HttpRequest in either of `@azerothcore/eluna-ts-lib` or `@azerothcore/eluna-ts-definitions`.
rektbyfaith
07-05-2024, 09:18 PM #4

Archived author: johnford2002 • Posted: 2024-07-05T21:18:05.711000+00:00
Original source

Any idea what types would be missing? I don't see any references to HttpRequest in either of `@azerothcore/eluna-ts-lib` or `@azerothcore/eluna-ts-definitions`.

rektbyfaith
Administrator
0
07-05-2024, 09:20 PM
#5
Archived author: Roboto • Posted: 2024-07-05T21:20:52.764000+00:00
Original source

The TS definitions are pretty out of date and incorrect at times
rektbyfaith
07-05-2024, 09:20 PM #5

Archived author: Roboto • Posted: 2024-07-05T21:20:52.764000+00:00
Original source

The TS definitions are pretty out of date and incorrect at times

rektbyfaith
Administrator
0
07-05-2024, 09:21 PM
#6
Archived author: Roboto • Posted: 2024-07-05T21:21:06.511000+00:00
Original source

it's been on my todo list for a while
rektbyfaith
07-05-2024, 09:21 PM #6

Archived author: Roboto • Posted: 2024-07-05T21:21:06.511000+00:00
Original source

it's been on my todo list for a while

rektbyfaith
Administrator
0
07-05-2024, 09:22 PM
#7
Archived author: johnford2002 • Posted: 2024-07-05T21:22:28.945000+00:00
Original source

I tried declaring a type locally, which does make TS happy, but the resulting Lua output wants to inject `nil` as the first passed argument instead of the HTTP method argument.
rektbyfaith
07-05-2024, 09:22 PM #7

Archived author: johnford2002 • Posted: 2024-07-05T21:22:28.945000+00:00
Original source

I tried declaring a type locally, which does make TS happy, but the resulting Lua output wants to inject `nil` as the first passed argument instead of the HTTP method argument.

rektbyfaith
Administrator
0
07-05-2024, 10:02 PM
#8
Archived author: johnford2002 • Posted: 2024-07-05T22:02:36.414000+00:00
Original source

Hmm... seems like adding `this: void` to the start of the signature eliminates that issue, but it persists with other declared global functions like `GetPlayerByGuid()`, as I think they suffer from the same problem.

Here's where I landed to get the resulting lua script to actually work:
```
declare function HttpRequest(this: void, method: string, url: string, cb: any): void;
declare function GetPlayerByGUID(this: void, guid: number): Player;
export const OnPlayerRequest: player_event_on_chat = (
event: number,
player: Player,
msg: string
): string | boolean => {
if (msg == "#example") {
const playerGuid = player.GetGUID()

HttpRequest("GET", "https://random-word-api.herokuapp.com/word", () => {
const callbackPlayer = GetPlayerByGUID(playerGuid)
callbackPlayer.SendBroadcastMessage("Hurray!")
});
}

return true;
}
```
rektbyfaith
07-05-2024, 10:02 PM #8

Archived author: johnford2002 • Posted: 2024-07-05T22:02:36.414000+00:00
Original source

Hmm... seems like adding `this: void` to the start of the signature eliminates that issue, but it persists with other declared global functions like `GetPlayerByGuid()`, as I think they suffer from the same problem.

Here's where I landed to get the resulting lua script to actually work:
```
declare function HttpRequest(this: void, method: string, url: string, cb: any): void;
declare function GetPlayerByGUID(this: void, guid: number): Player;
export const OnPlayerRequest: player_event_on_chat = (
event: number,
player: Player,
msg: string
): string | boolean => {
if (msg == "#example") {
const playerGuid = player.GetGUID()

HttpRequest("GET", "https://random-word-api.herokuapp.com/word", () => {
const callbackPlayer = GetPlayerByGUID(playerGuid)
callbackPlayer.SendBroadcastMessage("Hurray!")
});
}

return true;
}
```

Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)