Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing fixes #16

Closed
Tracked by #15
insyri opened this issue Nov 27, 2022 · 1 comment
Closed
Tracked by #15

Typing fixes #16

insyri opened this issue Nov 27, 2022 · 1 comment

Comments

@insyri
Copy link
Owner

insyri commented Nov 27, 2022

No description provided.

@insyri insyri mentioned this issue Nov 27, 2022
12 tasks
@insyri
Copy link
Owner Author

insyri commented Nov 27, 2022

The cause comes from the way files are handled around Deno and Node.js. See affected lines:

import { RESTPostAPIGuildsJSONBody } from 'discord-api-types/rest/v8/guild.ts';
import { APIUnavailableGuild } from 'discord-api-types/payloads/v8/guild.ts';

In Deno, this is perfectly fine, in Node.js, the imports are not found. It would be required to instead reference the index of the v8 instead of the direct guild file, like so:

import { RESTPostAPIGuildsJSONBody } from "discord-api-types/rest/v8";
import { APIUnavailableGuild } from "discord-api-types/payloads/v8";

Inspect both of these inside an IDE and intellisense will prove it so. Also, Deno has the mod.ts extension rather than the index.ts, so we would have to add a script to edit that.

Pseudo Solution

The transpiled (deno->node, not ts->js) Node version of these imports look like this:

import { RESTPostAPIGuildsJSONBody } from "discord-api-types/rest/v8/guild";
import { APIUnavailableGuild } from "discord-api-types/payloads/v8/guild";

The directive to transform this would be to reference the parent folder of the guild module.

- import { RESTPostAPIGuildsJSONBody } from "discord-api-types/rest/v8/guild";
+ import { RESTPostAPIGuildsJSONBody } from "discord-api-types/rest/v8";
- import { APIUnavailableGuild } from "discord-api-types/payloads/v8/guild";
+ import { APIUnavailableGuild } from "discord-api-types/payloads/v8";

Probably a build tag like build:ref-parent-module with a regex that matches an import, within that, find of last occurrence of / and delete until ".

@insyri insyri closed this as completed in 19b8e53 Dec 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant