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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commands plugin typo in flavor installation #1186

Open
carafelix opened this issue Feb 2, 2025 · 3 comments
Open

Commands plugin typo in flavor installation #1186

carafelix opened this issue Feb 2, 2025 · 3 comments

Comments

@carafelix
Copy link
Member

carafelix commented Feb 2, 2025

type MyContext = Context & CommandsFlavor;

 type MyContext = CommandsFlavor<Context>;

and

const loggedOutCommands = new CommandGroup();
const loggedInCommands = new CommandGroup();

const loggedOutCommands = new CommandGroup<MyContext>();
const loggedInCommands = new CommandGroup<MyContext>();
@KnightNiwrem
Copy link
Contributor

Technically, type MyContext = Context & CommandsFlavor is equivalent to type MyContext = Context & CommandsFlavor<Context>, since CommandsFlavor provides a default Context type where the parameter type is not given - i.e. interface CommandsFlavor<C extends Context = Context> extends Context {}.

Is there any particular reason why we want the Context & part when CommandsFlavor already extends Context?

Circular types feels a bit weird to me. I'm not sure what to think of it.

@carafelix
Copy link
Member Author

carafelix commented Feb 3, 2025

Is there any particular reason why we want the Context & part when CommandsFlavor already extends Context?

as you pointed out: there isn't

@KnorpelSenf
Copy link
Member

Should actually be:

 type MyContext = CommandsFlavor<Context>;

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

3 participants