Whats the difference between the different imports?
Some packages reexport things from djs for example.
What is the best practise to use?
And whats the difference?
![](https://utfs.io/f/98a069bd-d5ee-44a5-bf61-69616f2bab51-1nq2cb.png)
Solution:Jump to solution
discord.js only exports a type which is an alias for string. @sapphire/snowflake is a TS implementation of the snowflake system. They are 2 completely different things.
(also you could've found this out by checking the djs and sapphire docs)...
6 Replies
discord.js' is
type Snowflake = string;
, the other is a class pre-instantiated as DiscordSnowflake
and TwitterSnowflake
, which serves snowflake utilities to read data from it. Discord.js re-exports the former as SnowflakeUtil
.Solution
discord.js only exports a type which is an alias for string. @sapphire/snowflake is a TS implementation of the snowflake system. They are 2 completely different things.
(also you could've found this out by checking the djs and sapphire docs)
this doesn't answer my full question.
its less specific about the Snowflake until but more generally a "how to proceed when there are two equal called functions to import that (often) do the same"
Is it better to import from DJs, because it's "safer" of some kind, or the one from the smaller package for reason xyz?
codeBlock would be a good example for example.
(if its the same)
is it better to use the djs or the djs utilities one?
![](https://utfs.io/f/6ec8a110-f5fc-4d73-b823-9a7382d96ad8-1nq2cb.png)
IMHO sapphire because we do additional parsing
With djs if you import a nested codeblocks you get garbled text but with sapphire we escape that.
So you're really just gonna have to check the source code for these things
It's really a case by case thing
thanks!@