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

Object selection models and plugins #21

Merged
merged 7 commits into from
Sep 18, 2017
Merged

Conversation

anthonydresser
Copy link
Contributor

Adds the ability to specific selection models and plugins via the objects themselves rather than through names and assuming they will be attached to the global Slick object.

Also adds mapping files for easier debugging.

for (let plugin of this.plugins) {
this.registerPlugin(plugin);
if (typeof plugin === 'string') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need this if check anymore, correct? registerPlugin accepts the plugin whether it's a string or a plugin object, so you can get rid of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its a bug in typescript, if I don't add a type check if complains string | object not assignable to string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I could fix it by not overloading the function and instead just having the input as string | object

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like its a bug that they couldn't find a good way to fix, so they said just workaround it via my solution about just using a union type instead of an overload microsoft/TypeScript#1805

@anthonydresser anthonydresser merged commit d122015 into master Sep 18, 2017
@anthonydresser anthonydresser deleted the feature/objectPlugins branch September 18, 2017 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants