Skip to content
This repository has been archived by the owner on Jan 8, 2022. It is now read-only.

Unnecessarily strict typings #55

Open
Lioness100 opened this issue Jan 2, 2022 · 0 comments · May be fixed by #56
Open

Unnecessarily strict typings #55

Lioness100 opened this issue Jan 2, 2022 · 0 comments · May be fixed by #56
Labels
bug Something isn't working need repro

Comments

@Lioness100
Copy link

Lioness100 commented Jan 2, 2022

Issue description

The following error can be produced with any two collections that have different key or value types. I understand why you shouldn't be able to use two collections with different key types, as the resulting collection will always be empty, however, I don't understand why you can't do two collections with different value types, as values aren't referenced at all in either of the functions below.

For example, if I had a collection of non-discord related data about users (Collection<Snowflake, RandomUserData>), and wanted to only view the data for users who are in a voice channel (VoiceChannel#members is Collection<Snowflake, GuildMember>), I wouldn't be able to.

Code sample

const collection1 = new Collection<string, string>(...);
const collection2 = new Collection<string, number>(...);

collection1.intersect(collection2);
collection1.difference(collection2);

// Argument of type 'Collection<string, number>' is not assignable to parameter of type 'Collection<string, string>'.

@discordjs/collection version

0.3.2

Node.js version

16.6.1

Operating system

Windows

Priority this issue should have

Low (slightly annoying)

@Lioness100 Lioness100 added bug Something isn't working need repro labels Jan 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working need repro
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant