Repository navigation
add an option that flags coercion #7746
Copy link
Copy link
Closed
Labels
SuggestionAn idea for TypeScriptAn idea for TypeScriptToo ComplexAn issue which adding support for may be too complex for the value it addsAn issue which adding support for may be too complex for the value it adds
Description
Activity
RyanCavanaugh commented
on Mar 31, 2016 MemberMore actionsYour first example is identical to a suggestion you've already logged.
Your second example doesn't typecheck.
zpdDG4gta8XKpMCd commented
on Mar 31, 2016 AuthorMore actions- technically it was about a more specific case (and probably because of that it got closed), which alone didn't make much sense, this is a broader request that might have more sense
- fixed
- addedSuggestionAn idea for TypeScriptAn idea for TypeScriptNeeds ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.This issue needs a plan that clarifies the finer details of how it could be implemented.
on Apr 1, 2016 zpdDG4gta8XKpMCd commented
on Apr 2, 2016 AuthorMore actionsanother example out of the oven
// before declare function toBypassReasons(): string[]; let message = toBypassReasons().join(', '); // after refactoring interface BypassReason { reason: string; ruleKey: string; } declare function toBypassReasons() : BypassReason[]; let message = toBypassReasons().join(', '); // <-- bug
RyanCavanaugh commented
on Apr 2, 2016 MemberMore actionsThere is literally zero coercion in that example. You'd need completely different mechanics (somehow disallowing certain methods when a type parameter is one value vs another) to detect that "bug" vs the other two examples.
closing in favor of #7989
- addedHelp WantedYou can do thisYou can do thisToo ComplexAn issue which adding support for may be too complex for the value it addsAn issue which adding support for may be too complex for the value it addsand removedNeeds ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.This issue needs a plan that clarifies the finer details of how it could be implemented.Help WantedYou can do thisYou can do this
on Jun 8, 2016 RyanCavanaugh commented
on Jun 9, 2016 MemberMore actionsTracking a new issue at #9041 that solves some of these cases
- locked and limited conversation to collaborators
on Jun 19, 2018
Metadata
Metadata
Assignees
Labels
SuggestionAn idea for TypeScriptAn idea for TypeScriptToo ComplexAn issue which adding support for may be too complex for the value it addsAn issue which adding support for may be too complex for the value it adds
There is a category of bugs caused by unintended coercion at runtime. Such bugs can be found by the compiler. Having an option that bans such coercion would be a great addition.
examples of the problem: