Skip to content

Conversation

@gluxon
Copy link
Member

@gluxon gluxon commented May 30, 2022

This allows the LockfileFile to Lockfile conversion to be slightly better abstracted since the type assertion is now tightly grouped with the logic performing the conversion.

This will be useful for #4725, which operates off of the Lockfile type to perform additional conversions.

/**
* Reverts changes from the "forceSharedFormat" write option if necessary.
*/
function convertFromLockfileFileMutable (lockfileFile: LockfileFile): Lockfile {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block was moved with no changes.

prefix,
})
}
return { lockfile: lockfileFile as Lockfile, hadConflicts }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving this type assertion was the main motivation of the PR.

@gluxon gluxon force-pushed the lockfilefile-read-type-safety branch from e9b6bf9 to 61b6d62 Compare May 30, 2022 22:00
@gluxon gluxon changed the title style(lockfile-file): Abstract LockfileFile to Lockfile conversion refactor(lockfile-file): Abstract LockfileFile to Lockfile conversion May 30, 2022
@gluxon
Copy link
Member Author

gluxon commented May 30, 2022

CI checks currently failing due to #4825.

gluxon added 2 commits May 31, 2022 21:03
This allows the `LockfileFile` to `Lockfile` conversion to be slightly
better abstracted since the type assertion is now tightly grouped with
the logic performing the conversion.

This will be useful for pnpm#4725, which operates off of the `Lockfile`
type to perform additional conversions.
@gluxon gluxon force-pushed the lockfilefile-read-type-safety branch from 61b6d62 to 90bf15e Compare June 1, 2022 01:03
@gluxon gluxon marked this pull request as ready for review June 1, 2022 04:04
@zkochan zkochan merged commit 4d1b0d2 into pnpm:main Jun 1, 2022
@gluxon gluxon deleted the lockfilefile-read-type-safety branch July 20, 2022 05:55
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