Skip to content

Conversation

@brianjgeiger
Copy link
Contributor

@brianjgeiger brianjgeiger commented Jun 23, 2022

Purpose

We had a ts error on build that wasn't caught by eslint. Apparently we were too clever with an if statement, and had to be more explicit.

lib/osf-components/addon/components/file-browser/file-rename-modal/component.ts:31:46 - error TS2532: Object is possibly 'undefined'.

31         return (Boolean(this.newFileName) && this.newFileName.trim() !== this.originalFileName &&
                                                ~~~~~~~~~~~~~~~~

lib/osf-components/addon/components/file-browser/file-rename-modal/component.ts:32:13 - error TS2532: Object is possibly 'undefined'.

32             this.newFileName.trim() !== '');
               ~~~~~~~~~~~~~~~~

Summary of Changes

  1. Wrap return in an if statement to check for the existence of newFileName

Side Effects

No, this is isolated.

QA Notes

This should change nothing about the functionality of the rename modal. It should still not allow you to rename a file to pure whitespace nor to the original filename with whitespace on the ends.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 2551107443

  • 2 of 3 (66.67%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.01%) to 70.454%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/osf-components/addon/components/file-browser/file-rename-modal/component.ts 2 3 66.67%
Totals Coverage Status
Change from base Build 2550981411: -0.01%
Covered Lines: 5211
Relevant Lines: 7183

💛 - Coveralls

@brianjgeiger brianjgeiger merged commit e6cfb91 into CenterForOpenScience:develop Jun 23, 2022
@brianjgeiger brianjgeiger deleted the feature/fix-tslint-newFileName branch June 23, 2022 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants