Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

Fix type param constraint. Support defaults. #163

Merged
merged 3 commits into from
Nov 16, 2018
Merged

Fix type param constraint. Support defaults. #163

merged 3 commits into from
Nov 16, 2018

Conversation

milesj
Copy link
Contributor

@milesj milesj commented Nov 8, 2018

After updating to the latest, I started seeing this error a lot.

TypeError: Cannot read property 'typeAnnotation' of undefined
    at markTypeAnnotationAsUsed (/Users/Miles/Sites/boost/node_modules/eslint-plugin-typescript/lib/rules/no-unused-vars.js:71:37)
    at markTypeAnnotationAsUsed (/Users/Miles/Sites/boost/node_modules/eslint-plugin-typescript/lib/rules/no-unused-vars.js:126:21)
    at Array.forEach (<anonymous>)
    at markClassOptionsAsUsed (/Users/Miles/Sites/boost/node_modules/eslint-plugin-typescript/lib/rules/no-unused-vars.js:260:44)
    at listeners.(anonymous function).forEach.listener (/Users/Miles/Sites/boost/node_modules/eslint/lib/util/safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/Miles/Sites/boost/node_modules/eslint/lib/util/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/Miles/Sites/boost/node_modules/eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (/Users/Miles/Sites/boost/node_modules/eslint/lib/util/node-event-generator.js:280:22)
    at NodeEventGenerator.enterNode (/Users/Miles/Sites/boost/node_modules/eslint/lib/util/node-event-generator.js:294:14)

Seems like some params have an undefined constraint, so add a check for it.

I also added support for defaults, <T = Foo>, since that doesn't seem to be covered.

@milesj
Copy link
Contributor Author

milesj commented Nov 8, 2018

@nzakas

@bradzacher
Copy link
Owner

Thanks for your contribution!

@bradzacher bradzacher merged commit a68d424 into bradzacher:master Nov 16, 2018
@milesj milesj deleted the fix-constraint branch November 16, 2018 18:07
@bradzacher bradzacher added this to the 1.0.0 milestone Nov 17, 2018
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.

None yet

3 participants