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

fix: interfaces not importing due to re-export of Snowflake #5723

Merged
merged 2 commits into from Jun 2, 2021

Conversation

iShibi
Copy link
Contributor

@iShibi iShibi commented Jun 1, 2021

Please describe the changes this PR makes and why it should be merged:

This PR tries to fix the issue caused by re-export of Snowflake in #5722. The re-export of Snowflake made all the interfaces and types of discord.js non-importable. I tried to find a correct way of re-exporting types in a declaration file but couldn't find anything that helped. So, instead of importing the Snowflake type from discord-api-types, I defined the type in the lib itself just like other types. This kept the typings support that Snowflake introduced while also made it and other types importable again.

Thanks, @ToasterSticks for noticing a issue...again 馃槅

Status and versioning classification:

  • I know how to update typings and have done so, or typings don't need updating

@kyranet
Copy link
Member

kyranet commented Jun 1, 2021

What about doing this instead?

export { Snowflake } from 'discord-api-types/v8';

Alongside the import, it's a pattern I used in my early days and it always worked.

@iShibi
Copy link
Contributor Author

iShibi commented Jun 1, 2021

I did try that (but only outside the declare module) while I was looking for possible fixes but doing so was somehow making the other typings modules like @discordjs/collection and ws not importable in the declaration file. Doing so inside the declare module alongside the import isn't showing this error but it also doesn't fix the issue. The only fix that I can see until the rewrite of declaration file is exporting all the interfaces and types explicitly.

@monbrey
Copy link
Member

monbrey commented Jun 1, 2021

Can't apply suggestions on the deleted lines, but

    Snowflake as APISnowflake, // from api-types
    
    type Snowflake = APISnowflake; // inside module

This seems to resolve it for me

@iCrawl iCrawl linked an issue Jun 2, 2021 that may be closed by this pull request
@iCrawl iCrawl merged commit 086c3f0 into discordjs:master Jun 2, 2021
@iShibi iShibi deleted the fix-typings branch June 15, 2021 15:01
@iCrawl iCrawl added this to the Version 13 milestone Jun 27, 2021
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

Successfully merging this pull request may close these issues.

TS: issue with types
5 participants