-
Notifications
You must be signed in to change notification settings - Fork 723
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
Use const enums for BindingScope, BindingType, TargetType #706
Comments
This change looks good to me. Are u planning to send a PR? |
Yes :) |
You know, this actually is a breaking change. You would no longer be able to use sring literals as many likely do. I'll hold off the change. microsoft/TypeScript#17690 Steps to make the change locally are:
|
microsoft/TypeScript#17690 (comment) Will just use a |
@JoshuaKGoldberg I noticed that we already have them https://github.com/inversify/InversifyJS/blob/e3b2871729aeb328ef5d2366282bffa4dc2c1a62/src/constants/literal_types.ts but they are not exposed |
Closing this issue by #718 You can now do: import { BindingScopeEnum, Container } from "inversify";
const container = new Container({
defaultScope: BindingScopeEnum.Singleton,
}); This feature is available in 4.7.0 🎉 |
Now that TypeScript supports string values for enums, it'd be very convenient to switch from this:
...to this:
That way, instead of hardcoding string literals:
...we can use slightly-easier-to-get-intellisense-for enum members:
The text was updated successfully, but these errors were encountered: