Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Relax TypedRule detection (fix #1637, fix #1522) #1728

Merged
merged 1 commit into from
Nov 17, 2016

Conversation

bcherny
Copy link
Contributor

@bcherny bcherny commented Nov 16, 2016

PR checklist

What changes did you make?

Relax TypedRule detection:

  • TypedRule exists to notify the consumer that they must implement the applyWithProgram method.
  • Checking instanceof is fragile, as is checking constructor.name.
  • Checking isTypedRule makes the API bulkier, though it is more explicit, which is good. My rationale is if the consumer defined applyWithProgram, then the intention is to make the rule a typed rule, so an additional flag is probably not necessary.

@palantirtech
Copy link
Member

Thanks for your interest in palantir/tslint, @bcherny! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

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

nice, I was just about to comment suggesting that you implement this with a type guard :)

@bcherny
Copy link
Contributor Author

bcherny commented Nov 16, 2016

Yeah, that assert was ugly :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants