Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Add noUnusedLocals: true to tsconfig. #127

Merged
merged 2 commits into from
Sep 21, 2017

Conversation

mattmazzola
Copy link
Member

First step in getting more of the TypeScript compiler checks on to help prevent bugs. This flag is more aesthetics than behavioral; however, it does help debugging and navigating code when looking up references. Since so many of the models and actions were imported into classes and not used it made it appear that they were used by more classes.

I did see a few issues around using Redux connect and microsoft/TypeScript#5938
It's related to trying to export Props which contains types from the Models class that were not explicitly imported.
I believe this is because we are using the returntypeof instead of explicitly defining the interfaces.

I noticed connect has generic overload <StateProps, DispatchProps, OwnProps> and it internally merges them all which is what I think we should be doing; however, currently don't have well established pattern so I left code as is.

I think we should be able to handle this; however, I agree it shouldn't be strict blocker as there are some known weirdness with TypeScript / Redux. If there are major issues we can temporarily revert the flag back.

First step in getting more of the TypeScript compiler checks on to help prevent bugs. This flag is more aesthetics than behavioral; however, it does help debugging and navigating code when looking up references.  Since so many of the models and actions were imported into classes and not used it made it appear that they were used by more classes.

I did see a few issues around using Redux `connect` and microsoft/TypeScript#5938
It's related to trying to export Props which contains types from the Models class that were not explicitly imported.
I believe this is because we are using the `returntypeof` instead of explicitly defining the interfaces.

I noticed `connect` has generic overload <StateProps, DispatchProps, OwnProps> and it internally merges them all which is what I think we should be doing; however, currently don't have well established pattern so I left code as is.
@msftclas
Copy link

@mattmazzola,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

@mattmazzola
Copy link
Member Author

Hmm, I noticed those issue i referenced is actually related to trying to output declaration files. For some reason we have, "declaration": true, although I don't know why. That's generally only for libraries which need to re-distribute their type-definition files.

@LarsLiden
Copy link
Member

Wasn't aware of this flag. Very cool.

@LarsLiden LarsLiden closed this Sep 21, 2017
@LarsLiden LarsLiden reopened this Sep 21, 2017
@msftclas
Copy link

@mattmazzola,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

@mattmazzola mattmazzola merged commit dcc9d0c into master Sep 21, 2017
@mattmazzola mattmazzola deleted the mattm/enable-nounusedlocals branch September 21, 2017 16:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants