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?
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)...
Jump to solution
6 Replies
kyra
kyra15mo ago
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
Favna
Favna15mo ago
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)
chillihero
chillihero15mo ago
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?
chillihero
chillihero15mo ago
codeBlock would be a good example for example. (if its the same) is it better to use the djs or the djs utilities one?
Favna
Favna15mo ago
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
chillihero
chillihero15mo ago
thanks!@