Skip to content

fix: update WorkspaceManifest packages field type to be non-null#8205

Merged
zkochan merged 1 commit intomainfrom
gluxon/manifest-packages
Jun 14, 2024
Merged

fix: update WorkspaceManifest packages field type to be non-null#8205
zkochan merged 1 commit intomainfrom
gluxon/manifest-packages

Conversation

@gluxon
Copy link
Member

@gluxon gluxon commented Jun 13, 2024

Changes

The packages field of WorkspaceManifest is currently defined as nullable, but I believe this won't ever be the case since we're verifying that it's always present in readWorkspaceManifest.

test('readWorkspaceManifest() throws on empty packages field', async () => {
await expect(
readWorkspaceManifest(path.join(__dirname, '__fixtures__/packages-empty'))
).rejects.toThrow('packages field missing or empty')
})

Let's remove the nullable type annotation to make it easier for code using WorkspaceManifest to read packages.

Motivation

This will be useful for #8120 (comment).

It'd be good to use the compiler to rely on patterns never being undefined, which would be the case if packages from WorkspaceManifest also can't be undefined.

@gluxon gluxon marked this pull request as ready for review June 13, 2024 23:12
@gluxon gluxon requested a review from zkochan as a code owner June 13, 2024 23:12
@gluxon gluxon changed the title fix: update WorkspaceManifest packages field to be non-null fix: update WorkspaceManifest packages field type to be non-null Jun 13, 2024
@zkochan zkochan merged commit 5d1ed94 into main Jun 14, 2024
@zkochan zkochan deleted the gluxon/manifest-packages branch June 14, 2024 00:54
@gluxon gluxon mentioned this pull request Jun 26, 2024
18 tasks
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