Skip to content

Remove unused initial value in Writer/File.ts writeImplementation#12

Merged
simonmika merged 4 commits intomaster-2from
copilot/sub-pr-10-again
Nov 6, 2025
Merged

Remove unused initial value in Writer/File.ts writeImplementation#12
simonmika merged 4 commits intomaster-2from
copilot/sub-pr-10-again

Conversation

Copy link
Contributor

Copilot AI commented Nov 6, 2025

Addresses code review feedback on #10 regarding an unused initial value in the writeImplementation method.

Changes

  • Removed unused initial true value from result variable in Writer/File.ts:40
  • Changed declaration from let result = true to let result: boolean

The initial value was unnecessary since result is always assigned in both the try block (r.bytesWritten == content.length) and catch block (false) before being read.

// Before
let result = true
const content = Buffer.from(buffer.reduce((r, item) => r + item, ""))
try {
  const r = await fs.write(this.descriptor, content, 0, content.length)
  result = r.bytesWritten == content.length
} catch {
  result = false
}

// After
let result: boolean
const content = Buffer.from(buffer.reduce((r, item) => r + item, ""))
try {
  const r = await fs.write(this.descriptor, content, 0, content.length)
  result = r.bytesWritten == content.length
} catch {
  result = false
}

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: simonmika <1467077+simonmika@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix feedback on refactoring to version 2 Remove unused initial value in Writer/File.ts writeImplementation Nov 6, 2025
Copilot AI requested a review from simonmika November 6, 2025 11:27
@simonmika simonmika marked this pull request as ready for review November 6, 2025 11:32
@simonmika simonmika merged commit 8bd79a8 into master-2 Nov 6, 2025
4 checks passed
@simonmika simonmika deleted the copilot/sub-pr-10-again branch November 6, 2025 11:58
simonmika added a commit that referenced this pull request Nov 6, 2025
* Updated configuration.

* Further cleanup.

* Fixed compile issues.

* Fixed remaining compile issues.

* Renamed test files.

* Full verification suite works.

* Breaking change, changed from isEmpty to empty.

* Modernized exports.

* Fixed remaining export import issues.

* Improved structure of Uri class.

* Improved Error.

* Fixed String.

* Removed String as it did not add significant value.

* Fixed Enumerator exports.

* Fixed file name of Enumerator.

* Fixed Device naming.

* Refactored Reader and Writer.

* Fix fs.write signature to use string overload instead of Buffer (#11)

* Initial plan

* Fix fs.write signature to use string overload with utf8 encoding

Co-authored-by: simonmika <1467077+simonmika@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: simonmika <1467077+simonmika@users.noreply.github.com>

* Remove unused initial value in Writer/File.ts writeImplementation (#12)

* Initial plan

* Fix unused initial value in Writer/File.ts writeImplementation

Co-authored-by: simonmika <1467077+simonmika@users.noreply.github.com>

* Fixed issues with fs.write signatures.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: simonmika <1467077+simonmika@users.noreply.github.com>
Co-authored-by: Simon Mika <simonmika@users.noreply.github.com>
Co-authored-by: Simon Mika <simon@mika.se>

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: simonmika <1467077+simonmika@users.noreply.github.com>
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.

2 participants